{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# Pandas基础学习"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=4622, step=1)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "import pandas as pd\r\n",
    "\r\n",
    "path1 = \"exercise_data/chipotle.tsv\" #文件路径,tsv指的是 \\t换行符进行分割\r\n",
    "chipo = pd.read_csv(path1, sep=\"\\t\")  #读文件\r\n",
    "\r\n",
    "chipo.head(10) #查看数据前十行  \r\n",
    "\r\n",
    "chipo.shape[1] #查看数据有多少列\r\n",
    "\r\n",
    "chipo.index #查看数据的索引是什么样的\r\n",
    "\r\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 解压数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 已解压请注释\r\n",
    "!unzip data/data71143/pandas_exercise.zip -d ."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 对应的数据集文件路径查看"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Apple_stock.csv  drinks.csv          second_cars_info.csv          wechart.csv\r\n",
      "cars.csv         Euro2012_stats.csv  train.csv                     wind.data\r\n",
      "chipotle.tsv     iris.csv            US_Crime_Rates_1960_2014.csv\r\n"
     ]
    }
   ],
   "source": [
    "ls exercise_data/"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习1-了解数据\n",
    "## Chipotle 快餐数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 从如下地址导入数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path1 = \"exercise_data/chipotle.tsv\"    # chipotle.tsv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据集存入一个名为chipo的数据框内"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "chipo = pd.read_csv(path1, sep = '\\t')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 查看前10行内容"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>order_id</th>\n",
       "      <th>quantity</th>\n",
       "      <th>item_name</th>\n",
       "      <th>choice_description</th>\n",
       "      <th>item_price</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Chips and Fresh Tomato Salsa</td>\n",
       "      <td>NaN</td>\n",
       "      <td>$2.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Izze</td>\n",
       "      <td>[Clementine]</td>\n",
       "      <td>$3.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Nantucket Nectar</td>\n",
       "      <td>[Apple]</td>\n",
       "      <td>$3.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Chips and Tomatillo-Green Chili Salsa</td>\n",
       "      <td>NaN</td>\n",
       "      <td>$2.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>[Tomatillo-Red Chili Salsa (Hot), [Black Beans...</td>\n",
       "      <td>$16.98</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   order_id  quantity                              item_name  \\\n",
       "0         1         1           Chips and Fresh Tomato Salsa   \n",
       "1         1         1                                   Izze   \n",
       "2         1         1                       Nantucket Nectar   \n",
       "3         1         1  Chips and Tomatillo-Green Chili Salsa   \n",
       "4         2         2                           Chicken Bowl   \n",
       "\n",
       "                                  choice_description item_price  \n",
       "0                                                NaN     $2.39   \n",
       "1                                       [Clementine]     $3.39   \n",
       "2                                            [Apple]     $3.39   \n",
       "3                                                NaN     $2.39   \n",
       "4  [Tomatillo-Red Chili Salsa (Hot), [Black Beans...    $16.98   "
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo.head(10)\n",
    "chipo.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 数据集中有多少个列(columns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo.shape[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo.shape[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 打印出全部的列名称"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['order_id', 'quantity', 'item_name', 'choice_description',\n",
       "       'item_price'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['order_id', 'quantity', 'item_name', 'choice_description', 'item_price']"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "list(chipo.columns)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 数据集的索引是怎样的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=4622, step=1)"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=4622, step=1)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo.index"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 被下单数最多商品(item)是什么?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "               item_name  quantity\n",
      "0      6 Pack Soft Drink        55\n",
      "1          Barbacoa Bowl        66\n",
      "2       Barbacoa Burrito        91\n",
      "3  Barbacoa Crispy Tacos        12\n",
      "4    Barbacoa Salad Bowl        10\n",
      "5    Barbacoa Soft Tacos        25\n",
      "6          Bottled Water       211\n",
      "7                   Bowl         4\n",
      "8                Burrito         6\n",
      "9            Canned Soda       126\n",
      "----------\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "\"\"\"\r\n",
    "    通过[[\"item_name\",\"quantity\"]]索引\r\n",
    "    利用groupby([\"item_name\"])进行分组，其中as_index=True表示将item_name作为索引输出\r\n",
    "    agg({\"quantity\":\"sum\"})通过分组之后，对quantity列进行加总\r\n",
    "\"\"\"\r\n",
    "c = chipo[[\"item_name\", \"quantity\"]].groupby(\"item_name\",as_index=False).agg({\"quantity\":\"sum\"})\r\n",
    "print(c.head(10))\r\n",
    "print(\"-\"*10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>item_name</th>\n",
       "      <th>quantity</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Carnitas Salad</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>Veggie Crispy Tacos</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>Chips and Mild Fresh Tomato Salsa</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>Crispy Tacos</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>Salad</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Bowl</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>Steak Salad</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>Veggie Salad</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Carnitas Salad Bowl</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Burrito</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                            item_name  quantity\n",
       "14                     Carnitas Salad         1\n",
       "46                Veggie Crispy Tacos         1\n",
       "26  Chips and Mild Fresh Tomato Salsa         1\n",
       "33                       Crispy Tacos         2\n",
       "36                              Salad         2\n",
       "7                                Bowl         4\n",
       "41                        Steak Salad         4\n",
       "47                       Veggie Salad         6\n",
       "15                Carnitas Salad Bowl         6\n",
       "8                             Burrito         6"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "c = chipo[[\"item_name\",\"quantity\"]].groupby(\"item_name\",as_index=False).agg({\"quantity\":sum})\r\n",
    "#sort_values()中有ascending=True参数表示从大到小排列，然后inplace = True表示排序后的数字是否替换掉原来的数字\r\n",
    "c.sort_values([\"quantity\"],ascending=True,inplace=True) \r\n",
    "c.head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>item_name</th>\n",
       "      <th>quantity</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Chicken Bowl</td>\n",
       "      <td>761</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Chicken Burrito</td>\n",
       "      <td>591</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>Chips and Guacamole</td>\n",
       "      <td>506</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>Steak Burrito</td>\n",
       "      <td>386</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Canned Soft Drink</td>\n",
       "      <td>351</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              item_name  quantity\n",
       "17         Chicken Bowl       761\n",
       "18      Chicken Burrito       591\n",
       "25  Chips and Guacamole       506\n",
       "39        Steak Burrito       386\n",
       "10    Canned Soft Drink       351"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码，做了修正\n",
    "c = chipo[['item_name','quantity']].groupby(['item_name'],as_index=False).agg({'quantity':sum})\n",
    "c.sort_values(['quantity'],ascending=False,inplace=True)\n",
    "c.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤10 在item_name这一列中，一共有多少种商品被下单？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Chips and Fresh Tomato Salsa', 'Izze', 'Nantucket Nectar', 'Chips and Tomatillo-Green Chili Salsa', 'Chicken Bowl', 'Side of Chips', 'Steak Burrito', 'Steak Soft Tacos', 'Chips and Guacamole', 'Chicken Crispy Tacos', 'Chicken Soft Tacos', 'Chicken Burrito', 'Canned Soda', 'Barbacoa Burrito', 'Carnitas Burrito', 'Carnitas Bowl', 'Bottled Water', 'Chips and Tomatillo Green Chili Salsa', 'Barbacoa Bowl', 'Chips', 'Chicken Salad Bowl', 'Steak Bowl', 'Barbacoa Soft Tacos', 'Veggie Burrito', 'Veggie Bowl', 'Steak Crispy Tacos', 'Chips and Tomatillo Red Chili Salsa', 'Barbacoa Crispy Tacos', 'Veggie Salad Bowl', 'Chips and Roasted Chili-Corn Salsa', 'Chips and Roasted Chili Corn Salsa', 'Carnitas Soft Tacos', 'Chicken Salad', 'Canned Soft Drink', 'Steak Salad Bowl', '6 Pack Soft Drink', 'Chips and Tomatillo-Red Chili Salsa', 'Bowl', 'Burrito', 'Crispy Tacos', 'Carnitas Crispy Tacos', 'Steak Salad', 'Chips and Mild Fresh Tomato Salsa', 'Veggie Soft Tacos', 'Carnitas Salad Bowl', 'Barbacoa Salad Bowl', 'Salad', 'Veggie Crispy Tacos', 'Veggie Salad', 'Carnitas Salad']\n",
      "----------\n",
      "50\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "unique = chipo[\"item_name\"].unique() #返回每个不重复具体的名称\r\n",
    "nunique = chipo[\"item_name\"].nunique() #返回每个不重复具体的名称的数目\r\n",
    "print(list(unique))\r\n",
    "print(\"-\"*10)\r\n",
    "print(nunique)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo['item_name'].nunique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤11 在choice_description中，下单次数最多的商品是什么？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Diet Coke]                                                                          134\n",
       "[Coke]                                                                               123\n",
       "[Sprite]                                                                              77\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Lettuce]]                42\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Guacamole, Lettuce]]     40\n",
       "[Fresh Tomato Salsa (Mild), [Pinto Beans, Rice, Cheese, Sour Cream]]                  36\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream]]                         33\n",
       "[Lemonade]                                                                            33\n",
       "[Fresh Tomato Salsa, [Rice, Cheese, Sour Cream, Lettuce]]                             29\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese]]                                     28\n",
       "Name: choice_description, dtype: int64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo[\"choice_description\"].value_counts().head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[Diet Coke]                                                                          134\n",
       "[Coke]                                                                               123\n",
       "[Sprite]                                                                              77\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Lettuce]]                42\n",
       "[Fresh Tomato Salsa, [Rice, Black Beans, Cheese, Sour Cream, Guacamole, Lettuce]]     40\n",
       "Name: choice_description, dtype: int64"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chipo['choice_description'].value_counts().head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤12 一共有多少商品被下单？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4972\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "total = chipo[\"quantity\"].sum()\r\n",
    "print(total)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4972"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "total_items_orders = chipo['quantity'].sum()\n",
    "total_items_orders"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤13 将item_price转换为浮点数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "object\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0        2.39\n",
       "1        3.39\n",
       "2        3.39\n",
       "3        2.39\n",
       "4       16.98\n",
       "        ...  \n",
       "4617    11.75\n",
       "4618    11.75\n",
       "4619    11.25\n",
       "4620     8.75\n",
       "4621     8.75\n",
       "Name: item_price, Length: 4622, dtype: float64"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(chipo[\"item_price\"].dtype)\r\n",
    "float1 = lambda x: float(x[1:-1])\r\n",
    "chipo[\"item_price\"].apply(float1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "dollarizer = lambda x: float(x[1:-1])\n",
    "chipo['item_price'] = chipo['item_price'].apply(dollarizer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0       1\n",
      "1       1\n",
      "2       1\n",
      "3       1\n",
      "4       2\n",
      "       ..\n",
      "4617    1\n",
      "4618    1\n",
      "4619    1\n",
      "4620    1\n",
      "4621    1\n",
      "Name: quantity, Length: 4622, dtype: int64 int64\n"
     ]
    },
    {
     "ename": "TypeError",
     "evalue": "unsupported format string passed to Series.__format__",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m/tmp/ipykernel_133/3054220867.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mfloat_1\u001b[0m \u001b[0;34m=\u001b[0m\u001b[0;32mlambda\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mfloat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0mchipo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"quantity\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfloat_1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"{:.2f}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mchipo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"quantity\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m: unsupported format string passed to Series.__format__"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(chipo[\"quantity\"],chipo[\"quantity\"].dtype)\r\n",
    "float_1 =lambda x: float(x)\r\n",
    "chipo[\"quantity\"].apply(float_1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤14 在该数据集对应的时期内，收入(revenue)是多少"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "float64\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "39237.02"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo.head()\r\n",
    "print(chipo[\"item_price\"].dtype)\r\n",
    "chipo[\"sub_total\"] = round(chipo[\"item_price\"]*chipo[\"quantity\"],2)\r\n",
    "chipo[\"sub_total\"].sum()\r\n",
    "\r\n",
    "\r\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "39237.02"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码,已经做更正\n",
    "chipo['sub_total'] = round(chipo['item_price'] * chipo['quantity'],2)\n",
    "chipo['sub_total'].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤15 在该数据集对应的时期内，一共有多少订单？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1834"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo['order_id'].nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1834"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo[\"order_id\"].nunique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤16 每一单(order)对应的平均总价是多少？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "21.39423118865867"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "chipo[[\"order_id\",\"sub_total\"]].groupby([\"order_id\"],as_index=False).agg({\"sub_total\":sum})[\"sub_total\"].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "21.39423118865867"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码，已经做过更正\n",
    "chipo[['order_id','sub_total']].groupby(by=['order_id']\n",
    ").agg({'sub_total':'sum'})['sub_total'].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤17 一共有多少种不同的商品被售出？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "50"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "chipo['item_name'].nunique()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "[返回练习题索引](#练习题索引)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习2-数据过滤与排序\n",
    "## 2012欧洲杯数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 - 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 - 从以下地址导入数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path2 = \"exercise_data/Euro2012_stats.csv\"      # Euro2012_stats.csv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 - 将数据集命名为euro12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>81.3%</td>\n",
       "      <td>41</td>\n",
       "      <td>62</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>9</td>\n",
       "      <td>60.1%</td>\n",
       "      <td>53</td>\n",
       "      <td>73</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>25</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>22</td>\n",
       "      <td>88.1%</td>\n",
       "      <td>43</td>\n",
       "      <td>45</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>54.6%</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "0         Croatia      4               13                12             51.9%   \n",
       "1  Czech Republic      4               13                18             41.9%   \n",
       "2         Denmark      4               10                10             50.0%   \n",
       "3         England      5               11                18             50.0%   \n",
       "4          France      3               22                24             37.9%   \n",
       "\n",
       "  % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "0            16.0%                          32             0              0   \n",
       "1            12.9%                          39             0              0   \n",
       "2            20.0%                          27             1              0   \n",
       "3            17.2%                          40             0              0   \n",
       "4             6.5%                          65             1              0   \n",
       "\n",
       "   Penalties not scored  ...  Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "0                     0  ...          13                 81.3%         41   \n",
       "1                     0  ...           9                 60.1%         53   \n",
       "2                     0  ...          10                 66.7%         25   \n",
       "3                     0  ...          22                 88.1%         43   \n",
       "4                     0  ...           6                 54.6%         36   \n",
       "\n",
       "  Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  Subs off  \\\n",
       "0             62         2             9          0        9         9   \n",
       "1             73         8             7          0       11        11   \n",
       "2             38         8             4          0        7         7   \n",
       "3             45         6             5          0       11        11   \n",
       "4             51         5             6          0       11        11   \n",
       "\n",
       "   Players Used  \n",
       "0            16  \n",
       "1            19  \n",
       "2            15  \n",
       "3            16  \n",
       "4            19  \n",
       "\n",
       "[5 rows x 35 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12 = pd.read_csv(path2)\r\n",
    "euro12.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>81.3%</td>\n",
       "      <td>41</td>\n",
       "      <td>62</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>9</td>\n",
       "      <td>60.1%</td>\n",
       "      <td>53</td>\n",
       "      <td>73</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>25</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>22</td>\n",
       "      <td>88.1%</td>\n",
       "      <td>43</td>\n",
       "      <td>45</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>54.6%</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>11</td>\n",
       "      <td>11</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>65.1%</td>\n",
       "      <td>67</td>\n",
       "      <td>48</td>\n",
       "      <td>12</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>6</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>43.0%</td>\n",
       "      <td>7.5%</td>\n",
       "      <td>110</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>20</td>\n",
       "      <td>74.1%</td>\n",
       "      <td>101</td>\n",
       "      <td>89</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "      <td>18</td>\n",
       "      <td>18</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>2</td>\n",
       "      <td>12</td>\n",
       "      <td>36</td>\n",
       "      <td>25.0%</td>\n",
       "      <td>4.1%</td>\n",
       "      <td>60</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>12</td>\n",
       "      <td>70.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>30</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "      <td>23</td>\n",
       "      <td>39.4%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>48</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>6</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>48</td>\n",
       "      <td>56</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>6</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>34.3%</td>\n",
       "      <td>9.3%</td>\n",
       "      <td>82</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>71.5%</td>\n",
       "      <td>73</td>\n",
       "      <td>90</td>\n",
       "      <td>10</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>12</td>\n",
       "      <td>36.8%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>17</td>\n",
       "      <td>65.4%</td>\n",
       "      <td>43</td>\n",
       "      <td>51</td>\n",
       "      <td>11</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>31</td>\n",
       "      <td>22.5%</td>\n",
       "      <td>12.5%</td>\n",
       "      <td>59</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>77.0%</td>\n",
       "      <td>34</td>\n",
       "      <td>43</td>\n",
       "      <td>4</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>15</td>\n",
       "      <td>93.8%</td>\n",
       "      <td>102</td>\n",
       "      <td>83</td>\n",
       "      <td>19</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "      <td>17</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>5</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>47.2%</td>\n",
       "      <td>13.8%</td>\n",
       "      <td>39</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>8</td>\n",
       "      <td>61.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>51</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2</td>\n",
       "      <td>7</td>\n",
       "      <td>26</td>\n",
       "      <td>21.2%</td>\n",
       "      <td>6.0%</td>\n",
       "      <td>38</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>76.5%</td>\n",
       "      <td>48</td>\n",
       "      <td>31</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>16 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Goals  Shots on target  Shots off target  \\\n",
       "0               Croatia      4               13                12   \n",
       "1        Czech Republic      4               13                18   \n",
       "2               Denmark      4               10                10   \n",
       "3               England      5               11                18   \n",
       "4                France      3               22                24   \n",
       "5               Germany     10               32                32   \n",
       "6                Greece      5                8                18   \n",
       "7                 Italy      6               34                45   \n",
       "8           Netherlands      2               12                36   \n",
       "9                Poland      2               15                23   \n",
       "10             Portugal      6               22                42   \n",
       "11  Republic of Ireland      1                7                12   \n",
       "12               Russia      5                9                31   \n",
       "13                Spain     12               42                33   \n",
       "14               Sweden      5               17                19   \n",
       "15              Ukraine      2                7                26   \n",
       "\n",
       "   Shooting Accuracy % Goals-to-shots  Total shots (inc. Blocked)  \\\n",
       "0              51.9%            16.0%                          32   \n",
       "1              41.9%            12.9%                          39   \n",
       "2              50.0%            20.0%                          27   \n",
       "3              50.0%            17.2%                          40   \n",
       "4              37.9%             6.5%                          65   \n",
       "5              47.8%            15.6%                          80   \n",
       "6              30.7%            19.2%                          32   \n",
       "7              43.0%             7.5%                         110   \n",
       "8              25.0%             4.1%                          60   \n",
       "9              39.4%             5.2%                          48   \n",
       "10             34.3%             9.3%                          82   \n",
       "11             36.8%             5.2%                          28   \n",
       "12             22.5%            12.5%                          59   \n",
       "13             55.9%            16.0%                         100   \n",
       "14             47.2%            13.8%                          39   \n",
       "15             21.2%             6.0%                          38   \n",
       "\n",
       "    Hit Woodwork  Penalty goals  Penalties not scored  ...  Saves made  \\\n",
       "0              0              0                     0  ...          13   \n",
       "1              0              0                     0  ...           9   \n",
       "2              1              0                     0  ...          10   \n",
       "3              0              0                     0  ...          22   \n",
       "4              1              0                     0  ...           6   \n",
       "5              2              1                     0  ...          10   \n",
       "6              1              1                     1  ...          13   \n",
       "7              2              0                     0  ...          20   \n",
       "8              2              0                     0  ...          12   \n",
       "9              0              0                     0  ...           6   \n",
       "10             6              0                     0  ...          10   \n",
       "11             0              0                     0  ...          17   \n",
       "12             2              0                     0  ...          10   \n",
       "13             0              1                     0  ...          15   \n",
       "14             3              0                     0  ...           8   \n",
       "15             0              0                     0  ...          13   \n",
       "\n",
       "    Saves-to-shots ratio  Fouls Won Fouls Conceded  Offsides  Yellow Cards  \\\n",
       "0                  81.3%         41             62         2             9   \n",
       "1                  60.1%         53             73         8             7   \n",
       "2                  66.7%         25             38         8             4   \n",
       "3                  88.1%         43             45         6             5   \n",
       "4                  54.6%         36             51         5             6   \n",
       "5                  62.6%         63             49        12             4   \n",
       "6                  65.1%         67             48        12             9   \n",
       "7                  74.1%        101             89        16            16   \n",
       "8                  70.6%         35             30         3             5   \n",
       "9                  66.7%         48             56         3             7   \n",
       "10                 71.5%         73             90        10            12   \n",
       "11                 65.4%         43             51        11             6   \n",
       "12                 77.0%         34             43         4             6   \n",
       "13                 93.8%        102             83        19            11   \n",
       "14                 61.6%         35             51         7             7   \n",
       "15                 76.5%         48             31         4             5   \n",
       "\n",
       "    Red Cards  Subs on  Subs off  Players Used  \n",
       "0           0        9         9            16  \n",
       "1           0       11        11            19  \n",
       "2           0        7         7            15  \n",
       "3           0       11        11            16  \n",
       "4           0       11        11            19  \n",
       "5           0       15        15            17  \n",
       "6           1       12        12            20  \n",
       "7           0       18        18            19  \n",
       "8           0        7         7            15  \n",
       "9           1        7         7            17  \n",
       "10          0       14        14            16  \n",
       "11          1       10        10            17  \n",
       "12          0        7         7            16  \n",
       "13          0       17        17            18  \n",
       "14          0        9         9            18  \n",
       "15          0        9         9            18  \n",
       "\n",
       "[16 rows x 35 columns]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12 = pd.read_csv(path2)\n",
    "euro12"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 只选取 ```Goals``` 这一列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      4\n",
       "1      4\n",
       "2      4\n",
       "3      5\n",
       "4      3\n",
       "5     10\n",
       "6      5\n",
       "7      6\n",
       "8      2\n",
       "9      2\n",
       "10     6\n",
       "11     1\n",
       "12     5\n",
       "13    12\n",
       "14     5\n",
       "15     2\n",
       "Name: Goals, dtype: int64"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12[\"Goals\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      4\n",
       "1      4\n",
       "2      4\n",
       "3      5\n",
       "4      3\n",
       "5     10\n",
       "6      5\n",
       "7      6\n",
       "8      2\n",
       "9      2\n",
       "10     6\n",
       "11     1\n",
       "12     5\n",
       "13    12\n",
       "14     5\n",
       "15     2\n",
       "Name: Goals, dtype: int64"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.Goals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 有多少球队参与了2012欧洲杯？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12.index.nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.shape[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 16 entries, 0 to 15\n",
      "Data columns (total 35 columns):\n",
      " #   Column                      Non-Null Count  Dtype  \n",
      "---  ------                      --------------  -----  \n",
      " 0   Team                        16 non-null     object \n",
      " 1   Goals                       16 non-null     int64  \n",
      " 2   Shots on target             16 non-null     int64  \n",
      " 3   Shots off target            16 non-null     int64  \n",
      " 4   Shooting Accuracy           16 non-null     object \n",
      " 5   % Goals-to-shots            16 non-null     object \n",
      " 6   Total shots (inc. Blocked)  16 non-null     int64  \n",
      " 7   Hit Woodwork                16 non-null     int64  \n",
      " 8   Penalty goals               16 non-null     int64  \n",
      " 9   Penalties not scored        16 non-null     int64  \n",
      " 10  Headed goals                16 non-null     int64  \n",
      " 11  Passes                      16 non-null     int64  \n",
      " 12  Passes completed            16 non-null     int64  \n",
      " 13  Passing Accuracy            16 non-null     object \n",
      " 14  Touches                     16 non-null     int64  \n",
      " 15  Crosses                     16 non-null     int64  \n",
      " 16  Dribbles                    16 non-null     int64  \n",
      " 17  Corners Taken               16 non-null     int64  \n",
      " 18  Tackles                     16 non-null     int64  \n",
      " 19  Clearances                  16 non-null     int64  \n",
      " 20  Interceptions               16 non-null     int64  \n",
      " 21  Clearances off line         15 non-null     float64\n",
      " 22  Clean Sheets                16 non-null     int64  \n",
      " 23  Blocks                      16 non-null     int64  \n",
      " 24  Goals conceded              16 non-null     int64  \n",
      " 25  Saves made                  16 non-null     int64  \n",
      " 26  Saves-to-shots ratio        16 non-null     object \n",
      " 27  Fouls Won                   16 non-null     int64  \n",
      " 28  Fouls Conceded              16 non-null     int64  \n",
      " 29  Offsides                    16 non-null     int64  \n",
      " 30  Yellow Cards                16 non-null     int64  \n",
      " 31  Red Cards                   16 non-null     int64  \n",
      " 32  Subs on                     16 non-null     int64  \n",
      " 33  Subs off                    16 non-null     int64  \n",
      " 34  Players Used                16 non-null     int64  \n",
      "dtypes: float64(1), int64(29), object(5)\n",
      "memory usage: 4.5+ KB\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12.info() #dataframe的信息"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 该数据集中一共有多少列(columns)?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 16 entries, 0 to 15\n",
      "Data columns (total 35 columns):\n",
      " #   Column                      Non-Null Count  Dtype  \n",
      "---  ------                      --------------  -----  \n",
      " 0   Team                        16 non-null     object \n",
      " 1   Goals                       16 non-null     int64  \n",
      " 2   Shots on target             16 non-null     int64  \n",
      " 3   Shots off target            16 non-null     int64  \n",
      " 4   Shooting Accuracy           16 non-null     object \n",
      " 5   % Goals-to-shots            16 non-null     object \n",
      " 6   Total shots (inc. Blocked)  16 non-null     int64  \n",
      " 7   Hit Woodwork                16 non-null     int64  \n",
      " 8   Penalty goals               16 non-null     int64  \n",
      " 9   Penalties not scored        16 non-null     int64  \n",
      " 10  Headed goals                16 non-null     int64  \n",
      " 11  Passes                      16 non-null     int64  \n",
      " 12  Passes completed            16 non-null     int64  \n",
      " 13  Passing Accuracy            16 non-null     object \n",
      " 14  Touches                     16 non-null     int64  \n",
      " 15  Crosses                     16 non-null     int64  \n",
      " 16  Dribbles                    16 non-null     int64  \n",
      " 17  Corners Taken               16 non-null     int64  \n",
      " 18  Tackles                     16 non-null     int64  \n",
      " 19  Clearances                  16 non-null     int64  \n",
      " 20  Interceptions               16 non-null     int64  \n",
      " 21  Clearances off line         15 non-null     float64\n",
      " 22  Clean Sheets                16 non-null     int64  \n",
      " 23  Blocks                      16 non-null     int64  \n",
      " 24  Goals conceded              16 non-null     int64  \n",
      " 25  Saves made                  16 non-null     int64  \n",
      " 26  Saves-to-shots ratio        16 non-null     object \n",
      " 27  Fouls Won                   16 non-null     int64  \n",
      " 28  Fouls Conceded              16 non-null     int64  \n",
      " 29  Offsides                    16 non-null     int64  \n",
      " 30  Yellow Cards                16 non-null     int64  \n",
      " 31  Red Cards                   16 non-null     int64  \n",
      " 32  Subs on                     16 non-null     int64  \n",
      " 33  Subs off                    16 non-null     int64  \n",
      " 34  Players Used                16 non-null     int64  \n",
      "dtypes: float64(1), int64(29), object(5)\n",
      "memory usage: 4.5+ KB\n"
     ]
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 将数据集中的列Team, Yellow Cards和Red Cards单独存为一个名叫discipline的数据框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Yellow Cards  Red Cards\n",
       "0               Croatia             9          0\n",
       "1        Czech Republic             7          0\n",
       "2               Denmark             4          0\n",
       "3               England             5          0\n",
       "4                France             6          0\n",
       "5               Germany             4          0\n",
       "6                Greece             9          1\n",
       "7                 Italy            16          0\n",
       "8           Netherlands             5          0\n",
       "9                Poland             7          1\n",
       "10             Portugal            12          0\n",
       "11  Republic of Ireland             6          1\n",
       "12               Russia             6          0\n",
       "13                Spain            11          0\n",
       "14               Sweden             7          0\n",
       "15              Ukraine             5          0"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "discipline = euro12[['Team', 'Yellow Cards', 'Red Cards']]\n",
    "discipline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 对数据框discipline按照先Red Cards再Yellow Cards进行排序 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Yellow Cards  Red Cards\n",
       "6                Greece             9          1\n",
       "9                Poland             7          1\n",
       "11  Republic of Ireland             6          1\n",
       "7                 Italy            16          0\n",
       "10             Portugal            12          0\n",
       "13                Spain            11          0\n",
       "0               Croatia             9          0\n",
       "1        Czech Republic             7          0\n",
       "14               Sweden             7          0\n",
       "4                France             6          0\n",
       "12               Russia             6          0\n",
       "3               England             5          0\n",
       "8           Netherlands             5          0\n",
       "15              Ukraine             5          0\n",
       "2               Denmark             4          0\n",
       "5               Germany             4          0"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "discipline.sort_values(['Red Cards', 'Yellow Cards'], ascending = False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 计算每个球队拿到的黄牌数的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7.0"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "round(discipline['Yellow Cards'].mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤10 找到进球数Goals超过6的球队数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>15</td>\n",
       "      <td>93.8%</td>\n",
       "      <td>102</td>\n",
       "      <td>83</td>\n",
       "      <td>19</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "      <td>17</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "5   Germany     10               32                32             47.8%   \n",
       "13    Spain     12               42                33             55.9%   \n",
       "\n",
       "   % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "5             15.6%                          80             2              1   \n",
       "13            16.0%                         100             0              1   \n",
       "\n",
       "    Penalties not scored  ...  Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "5                      0  ...          10                 62.6%         63   \n",
       "13                     0  ...          15                 93.8%        102   \n",
       "\n",
       "   Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  Subs off  \\\n",
       "5              49        12             4          0       15        15   \n",
       "13             83        19            11          0       17        17   \n",
       "\n",
       "    Players Used  \n",
       "5             17  \n",
       "13            18  \n",
       "\n",
       "[2 rows x 35 columns]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12[euro12[\"Goals\"]>6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>15</td>\n",
       "      <td>93.8%</td>\n",
       "      <td>102</td>\n",
       "      <td>83</td>\n",
       "      <td>19</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "      <td>17</td>\n",
       "      <td>17</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "5   Germany     10               32                32             47.8%   \n",
       "13    Spain     12               42                33             55.9%   \n",
       "\n",
       "   % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "5             15.6%                          80             2              1   \n",
       "13            16.0%                         100             0              1   \n",
       "\n",
       "    Penalties not scored  ...  Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "5                      0  ...          10                 62.6%         63   \n",
       "13                     0  ...          15                 93.8%        102   \n",
       "\n",
       "   Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  Subs off  \\\n",
       "5              49        12             4          0       15        15   \n",
       "13             83        19            11          0       17        17   \n",
       "\n",
       "    Players Used  \n",
       "5             17  \n",
       "13            18  \n",
       "\n",
       "[2 rows x 35 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12[euro12.Goals > 6]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤11 选取以字母G开头的球队数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>65.1%</td>\n",
       "      <td>67</td>\n",
       "      <td>48</td>\n",
       "      <td>12</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "5  Germany     10               32                32             47.8%   \n",
       "6   Greece      5                8                18             30.7%   \n",
       "\n",
       "  % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "5            15.6%                          80             2              1   \n",
       "6            19.2%                          32             1              1   \n",
       "\n",
       "   Penalties not scored  ...  Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "5                     0  ...          10                 62.6%         63   \n",
       "6                     1  ...          13                 65.1%         67   \n",
       "\n",
       "  Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  Subs off  \\\n",
       "5             49        12             4          0       15        15   \n",
       "6             48        12             9          1       12        12   \n",
       "\n",
       "   Players Used  \n",
       "5            17  \n",
       "6            20  \n",
       "\n",
       "[2 rows x 35 columns]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12[euro12.Team.str.startswith(\"G\")] #.str.startwith(\"G\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "      <th>Subs on</th>\n",
       "      <th>Subs off</th>\n",
       "      <th>Players Used</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "      <td>15</td>\n",
       "      <td>17</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>13</td>\n",
       "      <td>65.1%</td>\n",
       "      <td>67</td>\n",
       "      <td>48</td>\n",
       "      <td>12</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>12</td>\n",
       "      <td>20</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 35 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Team  Goals  Shots on target  Shots off target Shooting Accuracy  \\\n",
       "5  Germany     10               32                32             47.8%   \n",
       "6   Greece      5                8                18             30.7%   \n",
       "\n",
       "  % Goals-to-shots  Total shots (inc. Blocked)  Hit Woodwork  Penalty goals  \\\n",
       "5            15.6%                          80             2              1   \n",
       "6            19.2%                          32             1              1   \n",
       "\n",
       "   Penalties not scored  ...  Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "5                     0  ...          10                 62.6%         63   \n",
       "6                     1  ...          13                 65.1%         67   \n",
       "\n",
       "  Fouls Conceded  Offsides  Yellow Cards  Red Cards  Subs on  Subs off  \\\n",
       "5             49        12             4          0       15        15   \n",
       "6             48        12             9          1       12        12   \n",
       "\n",
       "   Players Used  \n",
       "5            17  \n",
       "6            20  \n",
       "\n",
       "[2 rows x 35 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12[euro12.Team.str.startswith('G')]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤12 选取前7列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>6</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>43.0%</td>\n",
       "      <td>7.5%</td>\n",
       "      <td>110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>2</td>\n",
       "      <td>12</td>\n",
       "      <td>36</td>\n",
       "      <td>25.0%</td>\n",
       "      <td>4.1%</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "      <td>23</td>\n",
       "      <td>39.4%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>6</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>34.3%</td>\n",
       "      <td>9.3%</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>12</td>\n",
       "      <td>36.8%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>31</td>\n",
       "      <td>22.5%</td>\n",
       "      <td>12.5%</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>5</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>47.2%</td>\n",
       "      <td>13.8%</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2</td>\n",
       "      <td>7</td>\n",
       "      <td>26</td>\n",
       "      <td>21.2%</td>\n",
       "      <td>6.0%</td>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Goals  Shots on target  Shots off target  \\\n",
       "0               Croatia      4               13                12   \n",
       "1        Czech Republic      4               13                18   \n",
       "2               Denmark      4               10                10   \n",
       "3               England      5               11                18   \n",
       "4                France      3               22                24   \n",
       "5               Germany     10               32                32   \n",
       "6                Greece      5                8                18   \n",
       "7                 Italy      6               34                45   \n",
       "8           Netherlands      2               12                36   \n",
       "9                Poland      2               15                23   \n",
       "10             Portugal      6               22                42   \n",
       "11  Republic of Ireland      1                7                12   \n",
       "12               Russia      5                9                31   \n",
       "13                Spain     12               42                33   \n",
       "14               Sweden      5               17                19   \n",
       "15              Ukraine      2                7                26   \n",
       "\n",
       "   Shooting Accuracy % Goals-to-shots  Total shots (inc. Blocked)  \n",
       "0              51.9%            16.0%                          32  \n",
       "1              41.9%            12.9%                          39  \n",
       "2              50.0%            20.0%                          27  \n",
       "3              50.0%            17.2%                          40  \n",
       "4              37.9%             6.5%                          65  \n",
       "5              47.8%            15.6%                          80  \n",
       "6              30.7%            19.2%                          32  \n",
       "7              43.0%             7.5%                         110  \n",
       "8              25.0%             4.1%                          60  \n",
       "9              39.4%             5.2%                          48  \n",
       "10             34.3%             9.3%                          82  \n",
       "11             36.8%             5.2%                          28  \n",
       "12             22.5%            12.5%                          59  \n",
       "13             55.9%            16.0%                         100  \n",
       "14             47.2%            13.8%                          39  \n",
       "15             21.2%             6.0%                          38  "
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "euro12.iloc[:, 0:7] #引用位置.iloc[:, 0:7]选取前7列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>6</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>43.0%</td>\n",
       "      <td>7.5%</td>\n",
       "      <td>110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>2</td>\n",
       "      <td>12</td>\n",
       "      <td>36</td>\n",
       "      <td>25.0%</td>\n",
       "      <td>4.1%</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "      <td>23</td>\n",
       "      <td>39.4%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>6</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>34.3%</td>\n",
       "      <td>9.3%</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>12</td>\n",
       "      <td>36.8%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>31</td>\n",
       "      <td>22.5%</td>\n",
       "      <td>12.5%</td>\n",
       "      <td>59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>5</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>47.2%</td>\n",
       "      <td>13.8%</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2</td>\n",
       "      <td>7</td>\n",
       "      <td>26</td>\n",
       "      <td>21.2%</td>\n",
       "      <td>6.0%</td>\n",
       "      <td>38</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Goals  Shots on target  Shots off target  \\\n",
       "0               Croatia      4               13                12   \n",
       "1        Czech Republic      4               13                18   \n",
       "2               Denmark      4               10                10   \n",
       "3               England      5               11                18   \n",
       "4                France      3               22                24   \n",
       "5               Germany     10               32                32   \n",
       "6                Greece      5                8                18   \n",
       "7                 Italy      6               34                45   \n",
       "8           Netherlands      2               12                36   \n",
       "9                Poland      2               15                23   \n",
       "10             Portugal      6               22                42   \n",
       "11  Republic of Ireland      1                7                12   \n",
       "12               Russia      5                9                31   \n",
       "13                Spain     12               42                33   \n",
       "14               Sweden      5               17                19   \n",
       "15              Ukraine      2                7                26   \n",
       "\n",
       "   Shooting Accuracy % Goals-to-shots  Total shots (inc. Blocked)  \n",
       "0              51.9%            16.0%                          32  \n",
       "1              41.9%            12.9%                          39  \n",
       "2              50.0%            20.0%                          27  \n",
       "3              50.0%            17.2%                          40  \n",
       "4              37.9%             6.5%                          65  \n",
       "5              47.8%            15.6%                          80  \n",
       "6              30.7%            19.2%                          32  \n",
       "7              43.0%             7.5%                         110  \n",
       "8              25.0%             4.1%                          60  \n",
       "9              39.4%             5.2%                          48  \n",
       "10             34.3%             9.3%                          82  \n",
       "11             36.8%             5.2%                          28  \n",
       "12             22.5%            12.5%                          59  \n",
       "13             55.9%            16.0%                         100  \n",
       "14             47.2%            13.8%                          39  \n",
       "15             21.2%             6.0%                          38  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.iloc[: , 0:7]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤13 选取除了最后3列之外的全部列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Goals</th>\n",
       "      <th>Shots on target</th>\n",
       "      <th>Shots off target</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "      <th>% Goals-to-shots</th>\n",
       "      <th>Total shots (inc. Blocked)</th>\n",
       "      <th>Hit Woodwork</th>\n",
       "      <th>Penalty goals</th>\n",
       "      <th>Penalties not scored</th>\n",
       "      <th>...</th>\n",
       "      <th>Clean Sheets</th>\n",
       "      <th>Blocks</th>\n",
       "      <th>Goals conceded</th>\n",
       "      <th>Saves made</th>\n",
       "      <th>Saves-to-shots ratio</th>\n",
       "      <th>Fouls Won</th>\n",
       "      <th>Fouls Conceded</th>\n",
       "      <th>Offsides</th>\n",
       "      <th>Yellow Cards</th>\n",
       "      <th>Red Cards</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Croatia</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>12</td>\n",
       "      <td>51.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>13</td>\n",
       "      <td>81.3%</td>\n",
       "      <td>41</td>\n",
       "      <td>62</td>\n",
       "      <td>2</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Czech Republic</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>18</td>\n",
       "      <td>41.9%</td>\n",
       "      <td>12.9%</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>6</td>\n",
       "      <td>9</td>\n",
       "      <td>60.1%</td>\n",
       "      <td>53</td>\n",
       "      <td>73</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Denmark</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>20.0%</td>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>25</td>\n",
       "      <td>38</td>\n",
       "      <td>8</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>18</td>\n",
       "      <td>50.0%</td>\n",
       "      <td>17.2%</td>\n",
       "      <td>40</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>29</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>88.1%</td>\n",
       "      <td>43</td>\n",
       "      <td>45</td>\n",
       "      <td>6</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>France</td>\n",
       "      <td>3</td>\n",
       "      <td>22</td>\n",
       "      <td>24</td>\n",
       "      <td>37.9%</td>\n",
       "      <td>6.5%</td>\n",
       "      <td>65</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>54.6%</td>\n",
       "      <td>36</td>\n",
       "      <td>51</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Germany</td>\n",
       "      <td>10</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>47.8%</td>\n",
       "      <td>15.6%</td>\n",
       "      <td>80</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>11</td>\n",
       "      <td>6</td>\n",
       "      <td>10</td>\n",
       "      <td>62.6%</td>\n",
       "      <td>63</td>\n",
       "      <td>49</td>\n",
       "      <td>12</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Greece</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>18</td>\n",
       "      <td>30.7%</td>\n",
       "      <td>19.2%</td>\n",
       "      <td>32</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>23</td>\n",
       "      <td>7</td>\n",
       "      <td>13</td>\n",
       "      <td>65.1%</td>\n",
       "      <td>67</td>\n",
       "      <td>48</td>\n",
       "      <td>12</td>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>6</td>\n",
       "      <td>34</td>\n",
       "      <td>45</td>\n",
       "      <td>43.0%</td>\n",
       "      <td>7.5%</td>\n",
       "      <td>110</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>18</td>\n",
       "      <td>7</td>\n",
       "      <td>20</td>\n",
       "      <td>74.1%</td>\n",
       "      <td>101</td>\n",
       "      <td>89</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Netherlands</td>\n",
       "      <td>2</td>\n",
       "      <td>12</td>\n",
       "      <td>36</td>\n",
       "      <td>25.0%</td>\n",
       "      <td>4.1%</td>\n",
       "      <td>60</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>5</td>\n",
       "      <td>12</td>\n",
       "      <td>70.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>30</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Poland</td>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "      <td>23</td>\n",
       "      <td>39.4%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>48</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>66.7%</td>\n",
       "      <td>48</td>\n",
       "      <td>56</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Portugal</td>\n",
       "      <td>6</td>\n",
       "      <td>22</td>\n",
       "      <td>42</td>\n",
       "      <td>34.3%</td>\n",
       "      <td>9.3%</td>\n",
       "      <td>82</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>4</td>\n",
       "      <td>10</td>\n",
       "      <td>71.5%</td>\n",
       "      <td>73</td>\n",
       "      <td>90</td>\n",
       "      <td>10</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Republic of Ireland</td>\n",
       "      <td>1</td>\n",
       "      <td>7</td>\n",
       "      <td>12</td>\n",
       "      <td>36.8%</td>\n",
       "      <td>5.2%</td>\n",
       "      <td>28</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>23</td>\n",
       "      <td>9</td>\n",
       "      <td>17</td>\n",
       "      <td>65.4%</td>\n",
       "      <td>43</td>\n",
       "      <td>51</td>\n",
       "      <td>11</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>5</td>\n",
       "      <td>9</td>\n",
       "      <td>31</td>\n",
       "      <td>22.5%</td>\n",
       "      <td>12.5%</td>\n",
       "      <td>59</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>3</td>\n",
       "      <td>10</td>\n",
       "      <td>77.0%</td>\n",
       "      <td>34</td>\n",
       "      <td>43</td>\n",
       "      <td>4</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Spain</td>\n",
       "      <td>12</td>\n",
       "      <td>42</td>\n",
       "      <td>33</td>\n",
       "      <td>55.9%</td>\n",
       "      <td>16.0%</td>\n",
       "      <td>100</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>15</td>\n",
       "      <td>93.8%</td>\n",
       "      <td>102</td>\n",
       "      <td>83</td>\n",
       "      <td>19</td>\n",
       "      <td>11</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Sweden</td>\n",
       "      <td>5</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>47.2%</td>\n",
       "      <td>13.8%</td>\n",
       "      <td>39</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>5</td>\n",
       "      <td>8</td>\n",
       "      <td>61.6%</td>\n",
       "      <td>35</td>\n",
       "      <td>51</td>\n",
       "      <td>7</td>\n",
       "      <td>7</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Ukraine</td>\n",
       "      <td>2</td>\n",
       "      <td>7</td>\n",
       "      <td>26</td>\n",
       "      <td>21.2%</td>\n",
       "      <td>6.0%</td>\n",
       "      <td>38</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>76.5%</td>\n",
       "      <td>48</td>\n",
       "      <td>31</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>16 rows × 32 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                   Team  Goals  Shots on target  Shots off target  \\\n",
       "0               Croatia      4               13                12   \n",
       "1        Czech Republic      4               13                18   \n",
       "2               Denmark      4               10                10   \n",
       "3               England      5               11                18   \n",
       "4                France      3               22                24   \n",
       "5               Germany     10               32                32   \n",
       "6                Greece      5                8                18   \n",
       "7                 Italy      6               34                45   \n",
       "8           Netherlands      2               12                36   \n",
       "9                Poland      2               15                23   \n",
       "10             Portugal      6               22                42   \n",
       "11  Republic of Ireland      1                7                12   \n",
       "12               Russia      5                9                31   \n",
       "13                Spain     12               42                33   \n",
       "14               Sweden      5               17                19   \n",
       "15              Ukraine      2                7                26   \n",
       "\n",
       "   Shooting Accuracy % Goals-to-shots  Total shots (inc. Blocked)  \\\n",
       "0              51.9%            16.0%                          32   \n",
       "1              41.9%            12.9%                          39   \n",
       "2              50.0%            20.0%                          27   \n",
       "3              50.0%            17.2%                          40   \n",
       "4              37.9%             6.5%                          65   \n",
       "5              47.8%            15.6%                          80   \n",
       "6              30.7%            19.2%                          32   \n",
       "7              43.0%             7.5%                         110   \n",
       "8              25.0%             4.1%                          60   \n",
       "9              39.4%             5.2%                          48   \n",
       "10             34.3%             9.3%                          82   \n",
       "11             36.8%             5.2%                          28   \n",
       "12             22.5%            12.5%                          59   \n",
       "13             55.9%            16.0%                         100   \n",
       "14             47.2%            13.8%                          39   \n",
       "15             21.2%             6.0%                          38   \n",
       "\n",
       "    Hit Woodwork  Penalty goals  Penalties not scored  ...  Clean Sheets  \\\n",
       "0              0              0                     0  ...             0   \n",
       "1              0              0                     0  ...             1   \n",
       "2              1              0                     0  ...             1   \n",
       "3              0              0                     0  ...             2   \n",
       "4              1              0                     0  ...             1   \n",
       "5              2              1                     0  ...             1   \n",
       "6              1              1                     1  ...             1   \n",
       "7              2              0                     0  ...             2   \n",
       "8              2              0                     0  ...             0   \n",
       "9              0              0                     0  ...             0   \n",
       "10             6              0                     0  ...             2   \n",
       "11             0              0                     0  ...             0   \n",
       "12             2              0                     0  ...             0   \n",
       "13             0              1                     0  ...             5   \n",
       "14             3              0                     0  ...             1   \n",
       "15             0              0                     0  ...             0   \n",
       "\n",
       "    Blocks  Goals conceded Saves made  Saves-to-shots ratio  Fouls Won  \\\n",
       "0       10               3         13                 81.3%         41   \n",
       "1       10               6          9                 60.1%         53   \n",
       "2       10               5         10                 66.7%         25   \n",
       "3       29               3         22                 88.1%         43   \n",
       "4        7               5          6                 54.6%         36   \n",
       "5       11               6         10                 62.6%         63   \n",
       "6       23               7         13                 65.1%         67   \n",
       "7       18               7         20                 74.1%        101   \n",
       "8        9               5         12                 70.6%         35   \n",
       "9        8               3          6                 66.7%         48   \n",
       "10      11               4         10                 71.5%         73   \n",
       "11      23               9         17                 65.4%         43   \n",
       "12       8               3         10                 77.0%         34   \n",
       "13       8               1         15                 93.8%        102   \n",
       "14      12               5          8                 61.6%         35   \n",
       "15       4               4         13                 76.5%         48   \n",
       "\n",
       "    Fouls Conceded  Offsides  Yellow Cards  Red Cards  \n",
       "0               62         2             9          0  \n",
       "1               73         8             7          0  \n",
       "2               38         8             4          0  \n",
       "3               45         6             5          0  \n",
       "4               51         5             6          0  \n",
       "5               49        12             4          0  \n",
       "6               48        12             9          1  \n",
       "7               89        16            16          0  \n",
       "8               30         3             5          0  \n",
       "9               56         3             7          1  \n",
       "10              90        10            12          0  \n",
       "11              51        11             6          1  \n",
       "12              43         4             6          0  \n",
       "13              83        19            11          0  \n",
       "14              51         7             7          0  \n",
       "15              31         4             5          0  \n",
       "\n",
       "[16 rows x 32 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.iloc[: , :-3]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤14 找到英格兰(England)、意大利(Italy)和俄罗斯(Russia)的进球占射门的比率(Shooting Accuracy)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0     False\n",
      "1     False\n",
      "2     False\n",
      "3      True\n",
      "4     False\n",
      "5     False\n",
      "6     False\n",
      "7      True\n",
      "8     False\n",
      "9     False\n",
      "10    False\n",
      "11    False\n",
      "12    False\n",
      "13    False\n",
      "14    False\n",
      "15    False\n",
      "Name: Team, dtype: bool\n",
      "      Team\n",
      "3  England\n",
      "7    Italy\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(euro12.Team.isin([\"England\", \"Italy\"]))\r\n",
    "print(euro12.loc[euro12.Team.isin([\"England\", \"Italy\"]), [\"Team\"]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Team</th>\n",
       "      <th>Shooting Accuracy</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>England</td>\n",
       "      <td>50.0%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Italy</td>\n",
       "      <td>43.0%</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Russia</td>\n",
       "      <td>22.5%</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Team Shooting Accuracy\n",
       "3   England             50.0%\n",
       "7     Italy             43.0%\n",
       "12   Russia             22.5%"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "euro12.loc[euro12.Team.isin(['England', 'Italy', 'Russia']), ['Team','Shooting Accuracy']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习3-数据分组\n",
    "## 酒类消费数据\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>country</th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "      <th>continent</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>AS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>89</td>\n",
       "      <td>132</td>\n",
       "      <td>54</td>\n",
       "      <td>4.9</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>25</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>0.7</td>\n",
       "      <td>AF</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>245</td>\n",
       "      <td>138</td>\n",
       "      <td>312</td>\n",
       "      <td>12.4</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Angola</td>\n",
       "      <td>217</td>\n",
       "      <td>57</td>\n",
       "      <td>45</td>\n",
       "      <td>5.9</td>\n",
       "      <td>AF</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Antigua &amp; Barbuda</td>\n",
       "      <td>102</td>\n",
       "      <td>128</td>\n",
       "      <td>45</td>\n",
       "      <td>4.9</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Argentina</td>\n",
       "      <td>193</td>\n",
       "      <td>25</td>\n",
       "      <td>221</td>\n",
       "      <td>8.3</td>\n",
       "      <td>SA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Armenia</td>\n",
       "      <td>21</td>\n",
       "      <td>179</td>\n",
       "      <td>11</td>\n",
       "      <td>3.8</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Australia</td>\n",
       "      <td>261</td>\n",
       "      <td>72</td>\n",
       "      <td>212</td>\n",
       "      <td>10.4</td>\n",
       "      <td>OC</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Austria</td>\n",
       "      <td>279</td>\n",
       "      <td>75</td>\n",
       "      <td>191</td>\n",
       "      <td>9.7</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             country  beer_servings  spirit_servings  wine_servings  \\\n",
       "0        Afghanistan              0                0              0   \n",
       "1            Albania             89              132             54   \n",
       "2            Algeria             25                0             14   \n",
       "3            Andorra            245              138            312   \n",
       "4             Angola            217               57             45   \n",
       "5  Antigua & Barbuda            102              128             45   \n",
       "6          Argentina            193               25            221   \n",
       "7            Armenia             21              179             11   \n",
       "8          Australia            261               72            212   \n",
       "9            Austria            279               75            191   \n",
       "\n",
       "   total_litres_of_pure_alcohol continent  \n",
       "0                           0.0        AS  \n",
       "1                           4.9        EU  \n",
       "2                           0.7        AF  \n",
       "3                          12.4        EU  \n",
       "4                           5.9        AF  \n",
       "5                           4.9       NaN  \n",
       "6                           8.3        SA  \n",
       "7                           3.8        EU  \n",
       "8                          10.4        OC  \n",
       "9                           9.7        EU  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "import pandas as pd\r\n",
    "path3 = \"exercise_data/drinks.csv\"\r\n",
    "drinks = pd.read_csv(path3)\r\n",
    "drinks.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 从以下地址导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path3 ='exercise_data/drinks.csv'    #'drinks.csv'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据框命名为drinks"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>country</th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "      <th>continent</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>AS</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>89</td>\n",
       "      <td>132</td>\n",
       "      <td>54</td>\n",
       "      <td>4.9</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>25</td>\n",
       "      <td>0</td>\n",
       "      <td>14</td>\n",
       "      <td>0.7</td>\n",
       "      <td>AF</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>245</td>\n",
       "      <td>138</td>\n",
       "      <td>312</td>\n",
       "      <td>12.4</td>\n",
       "      <td>EU</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Angola</td>\n",
       "      <td>217</td>\n",
       "      <td>57</td>\n",
       "      <td>45</td>\n",
       "      <td>5.9</td>\n",
       "      <td>AF</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       country  beer_servings  spirit_servings  wine_servings  \\\n",
       "0  Afghanistan              0                0              0   \n",
       "1      Albania             89              132             54   \n",
       "2      Algeria             25                0             14   \n",
       "3      Andorra            245              138            312   \n",
       "4       Angola            217               57             45   \n",
       "\n",
       "   total_litres_of_pure_alcohol continent  \n",
       "0                           0.0        AS  \n",
       "1                           4.9        EU  \n",
       "2                           0.7        AF  \n",
       "3                          12.4        EU  \n",
       "4                           5.9        AF  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks = pd.read_csv(path3)\n",
    "drinks.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 哪个大陆(continent)平均消耗的啤酒(beer)更多？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "           beer_servings\n",
      "continent               \n",
      "AF             61.471698\n",
      "AS             37.045455\n",
      "EU            193.777778\n",
      "OC             89.687500\n",
      "SA            175.083333\n",
      "----------------------------------------------------------------------------------------------------\n",
      "continent\n",
      "AF     61.471698\n",
      "AS     37.045455\n",
      "EU    193.777778\n",
      "OC     89.687500\n",
      "SA    175.083333\n",
      "Name: beer_servings, dtype: float64\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(drinks.groupby(\"continent\").agg({\"beer_servings\":\"mean\"}))\r\n",
    "print(\"-\"*100)\r\n",
    "print(drinks.groupby([\"continent\"]).beer_servings.mean())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "continent\n",
       "AF     61.471698\n",
       "AS     37.045455\n",
       "EU    193.777778\n",
       "OC     89.687500\n",
       "SA    175.083333\n",
       "Name: beer_servings, dtype: float64"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks.groupby('continent').beer_servings.mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 打印出每个大陆(continent)的红酒消耗(wine_servings)的描述性统计值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "           count        mean        std  min   25%    50%     75%    max\n",
      "continent                                                               \n",
      "AF          53.0   16.264151  38.846419  0.0   1.0    2.0   13.00  233.0\n",
      "AS          44.0    9.068182  21.667034  0.0   0.0    1.0    8.00  123.0\n",
      "EU          45.0  142.222222  97.421738  0.0  59.0  128.0  195.00  370.0\n",
      "OC          16.0   35.625000  64.555790  0.0   1.0    8.5   23.25  212.0\n",
      "SA          12.0   62.416667  88.620189  1.0   3.0   12.0   98.50  221.0\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(drinks.groupby(\"continent\").wine_servings.describe()) #描述统计量describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>count</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "      <th>min</th>\n",
       "      <th>25%</th>\n",
       "      <th>50%</th>\n",
       "      <th>75%</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>53.0</td>\n",
       "      <td>16.264151</td>\n",
       "      <td>38.846419</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>13.00</td>\n",
       "      <td>233.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>44.0</td>\n",
       "      <td>9.068182</td>\n",
       "      <td>21.667034</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>8.00</td>\n",
       "      <td>123.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>45.0</td>\n",
       "      <td>142.222222</td>\n",
       "      <td>97.421738</td>\n",
       "      <td>0.0</td>\n",
       "      <td>59.0</td>\n",
       "      <td>128.0</td>\n",
       "      <td>195.00</td>\n",
       "      <td>370.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>16.0</td>\n",
       "      <td>35.625000</td>\n",
       "      <td>64.555790</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>23.25</td>\n",
       "      <td>212.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>12.0</td>\n",
       "      <td>62.416667</td>\n",
       "      <td>88.620189</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>98.50</td>\n",
       "      <td>221.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           count        mean        std  min   25%    50%     75%    max\n",
       "continent                                                               \n",
       "AF          53.0   16.264151  38.846419  0.0   1.0    2.0   13.00  233.0\n",
       "AS          44.0    9.068182  21.667034  0.0   0.0    1.0    8.00  123.0\n",
       "EU          45.0  142.222222  97.421738  0.0  59.0  128.0  195.00  370.0\n",
       "OC          16.0   35.625000  64.555790  0.0   1.0    8.5   23.25  212.0\n",
       "SA          12.0   62.416667  88.620189  1.0   3.0   12.0   98.50  221.0"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks.groupby('continent').wine_servings.describe()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 打印出每个大陆每种酒类别的消耗平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>61.471698</td>\n",
       "      <td>16.339623</td>\n",
       "      <td>16.264151</td>\n",
       "      <td>3.007547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>37.045455</td>\n",
       "      <td>60.840909</td>\n",
       "      <td>9.068182</td>\n",
       "      <td>2.170455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>193.777778</td>\n",
       "      <td>132.555556</td>\n",
       "      <td>142.222222</td>\n",
       "      <td>8.617778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>89.687500</td>\n",
       "      <td>58.437500</td>\n",
       "      <td>35.625000</td>\n",
       "      <td>3.381250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>175.083333</td>\n",
       "      <td>114.750000</td>\n",
       "      <td>62.416667</td>\n",
       "      <td>6.308333</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           beer_servings  spirit_servings  wine_servings  \\\n",
       "continent                                                  \n",
       "AF             61.471698        16.339623      16.264151   \n",
       "AS             37.045455        60.840909       9.068182   \n",
       "EU            193.777778       132.555556     142.222222   \n",
       "OC             89.687500        58.437500      35.625000   \n",
       "SA            175.083333       114.750000      62.416667   \n",
       "\n",
       "           total_litres_of_pure_alcohol  \n",
       "continent                                \n",
       "AF                             3.007547  \n",
       "AS                             2.170455  \n",
       "EU                             8.617778  \n",
       "OC                             3.381250  \n",
       "SA                             6.308333  "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "drinks.groupby(\"continent\").mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>61.471698</td>\n",
       "      <td>16.339623</td>\n",
       "      <td>16.264151</td>\n",
       "      <td>3.007547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>37.045455</td>\n",
       "      <td>60.840909</td>\n",
       "      <td>9.068182</td>\n",
       "      <td>2.170455</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>193.777778</td>\n",
       "      <td>132.555556</td>\n",
       "      <td>142.222222</td>\n",
       "      <td>8.617778</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>89.687500</td>\n",
       "      <td>58.437500</td>\n",
       "      <td>35.625000</td>\n",
       "      <td>3.381250</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>175.083333</td>\n",
       "      <td>114.750000</td>\n",
       "      <td>62.416667</td>\n",
       "      <td>6.308333</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           beer_servings  spirit_servings  wine_servings  \\\n",
       "continent                                                  \n",
       "AF             61.471698        16.339623      16.264151   \n",
       "AS             37.045455        60.840909       9.068182   \n",
       "EU            193.777778       132.555556     142.222222   \n",
       "OC             89.687500        58.437500      35.625000   \n",
       "SA            175.083333       114.750000      62.416667   \n",
       "\n",
       "           total_litres_of_pure_alcohol  \n",
       "continent                                \n",
       "AF                             3.007547  \n",
       "AS                             2.170455  \n",
       "EU                             8.617778  \n",
       "OC                             3.381250  \n",
       "SA                             6.308333  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks.groupby('continent').mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 打印出每个大陆每种酒类别的消耗中位数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>32.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>17.5</td>\n",
       "      <td>16.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>219.0</td>\n",
       "      <td>122.0</td>\n",
       "      <td>128.0</td>\n",
       "      <td>10.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>52.5</td>\n",
       "      <td>37.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>1.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>162.5</td>\n",
       "      <td>108.5</td>\n",
       "      <td>12.0</td>\n",
       "      <td>6.85</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           beer_servings  spirit_servings  wine_servings  \\\n",
       "continent                                                  \n",
       "AF                  32.0              3.0            2.0   \n",
       "AS                  17.5             16.0            1.0   \n",
       "EU                 219.0            122.0          128.0   \n",
       "OC                  52.5             37.0            8.5   \n",
       "SA                 162.5            108.5           12.0   \n",
       "\n",
       "           total_litres_of_pure_alcohol  \n",
       "continent                                \n",
       "AF                                 2.30  \n",
       "AS                                 1.20  \n",
       "EU                                10.00  \n",
       "OC                                 1.75  \n",
       "SA                                 6.85  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "drinks.groupby(\"continent\").median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>beer_servings</th>\n",
       "      <th>spirit_servings</th>\n",
       "      <th>wine_servings</th>\n",
       "      <th>total_litres_of_pure_alcohol</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>32.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2.30</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>17.5</td>\n",
       "      <td>16.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>219.0</td>\n",
       "      <td>122.0</td>\n",
       "      <td>128.0</td>\n",
       "      <td>10.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>52.5</td>\n",
       "      <td>37.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>1.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>162.5</td>\n",
       "      <td>108.5</td>\n",
       "      <td>12.0</td>\n",
       "      <td>6.85</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           beer_servings  spirit_servings  wine_servings  \\\n",
       "continent                                                  \n",
       "AF                  32.0              3.0            2.0   \n",
       "AS                  17.5             16.0            1.0   \n",
       "EU                 219.0            122.0          128.0   \n",
       "OC                  52.5             37.0            8.5   \n",
       "SA                 162.5            108.5           12.0   \n",
       "\n",
       "           total_litres_of_pure_alcohol  \n",
       "continent                                \n",
       "AF                                 2.30  \n",
       "AS                                 1.20  \n",
       "EU                                10.00  \n",
       "OC                                 1.75  \n",
       "SA                                 6.85  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks.groupby('continent').median()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 打印出每个大陆对spirit饮品消耗的平均值，最大值和最小值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "          beer_servings          spirit_servings          wine_servings       \\\n",
      "                   mean  max min            mean  max min          mean  max   \n",
      "continent                                                                      \n",
      "AF            61.471698  376   0       16.339623  152   0     16.264151  233   \n",
      "AS            37.045455  247   0       60.840909  326   0      9.068182  123   \n",
      "EU           193.777778  361   0      132.555556  373   0    142.222222  370   \n",
      "OC            89.687500  306   0       58.437500  254   0     35.625000  212   \n",
      "SA           175.083333  333  93      114.750000  302  25     62.416667  221   \n",
      "\n",
      "              total_litres_of_pure_alcohol             \n",
      "          min                         mean   max  min  \n",
      "continent                                              \n",
      "AF          0                     3.007547   9.1  0.0  \n",
      "AS          0                     2.170455  11.5  0.0  \n",
      "EU          0                     8.617778  14.4  0.0  \n",
      "OC          0                     3.381250  10.4  0.0  \n",
      "SA          1                     6.308333   8.3  3.8  \n",
      "----------------------------------------------------------------------------------------------------\n",
      "          beer_servings                                                      \\\n",
      "                  count        mean        std   min     25%    50%     75%   \n",
      "continent                                                                     \n",
      "AF                 53.0   61.471698  80.557816   0.0   15.00   32.0   76.00   \n",
      "AS                 44.0   37.045455  49.469725   0.0    4.25   17.5   60.50   \n",
      "EU                 45.0  193.777778  99.631569   0.0  127.00  219.0  270.00   \n",
      "OC                 16.0   89.687500  96.641412   0.0   21.00   52.5  125.75   \n",
      "SA                 12.0  175.083333  65.242845  93.0  129.50  162.5  198.00   \n",
      "\n",
      "                 spirit_servings              ... wine_servings         \\\n",
      "             max           count        mean  ...           75%    max   \n",
      "continent                                     ...                        \n",
      "AF         376.0            53.0   16.339623  ...         13.00  233.0   \n",
      "AS         247.0            44.0   60.840909  ...          8.00  123.0   \n",
      "EU         361.0            45.0  132.555556  ...        195.00  370.0   \n",
      "OC         306.0            16.0   58.437500  ...         23.25  212.0   \n",
      "SA         333.0            12.0  114.750000  ...         98.50  221.0   \n",
      "\n",
      "          total_litres_of_pure_alcohol                                        \\\n",
      "                                 count      mean       std  min   25%    50%   \n",
      "continent                                                                      \n",
      "AF                                53.0  3.007547  2.647557  0.0  0.70   2.30   \n",
      "AS                                44.0  2.170455  2.770239  0.0  0.10   1.20   \n",
      "EU                                45.0  8.617778  3.358455  0.0  6.60  10.00   \n",
      "OC                                16.0  3.381250  3.345688  0.0  1.00   1.75   \n",
      "SA                                12.0  6.308333  1.531166  3.8  5.25   6.85   \n",
      "\n",
      "                         \n",
      "              75%   max  \n",
      "continent                \n",
      "AF          4.700   9.1  \n",
      "AS          2.425  11.5  \n",
      "EU         10.900  14.4  \n",
      "OC          6.150  10.4  \n",
      "SA          7.375   8.3  \n",
      "\n",
      "[5 rows x 32 columns]\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(drinks.groupby(\"continent\").agg([\"mean\", \"max\", \"min\"])) #连续输出描述统计值，用agg()函数，用列表即可\r\n",
    "print(\"-\"*100)\r\n",
    "print(drinks.groupby(\"continent\").describe())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>mean</th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>continent</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AF</th>\n",
       "      <td>16.339623</td>\n",
       "      <td>0</td>\n",
       "      <td>152</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AS</th>\n",
       "      <td>60.840909</td>\n",
       "      <td>0</td>\n",
       "      <td>326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>EU</th>\n",
       "      <td>132.555556</td>\n",
       "      <td>0</td>\n",
       "      <td>373</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OC</th>\n",
       "      <td>58.437500</td>\n",
       "      <td>0</td>\n",
       "      <td>254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SA</th>\n",
       "      <td>114.750000</td>\n",
       "      <td>25</td>\n",
       "      <td>302</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 mean  min  max\n",
       "continent                      \n",
       "AF          16.339623    0  152\n",
       "AS          60.840909    0  326\n",
       "EU         132.555556    0  373\n",
       "OC          58.437500    0  254\n",
       "SA         114.750000   25  302"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "drinks.groupby('continent').spirit_servings.agg(['mean', 'min', 'max'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习4-Apply函数\n",
    "## 1960 - 2014 美国犯罪数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 从以下地址导入数据集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 55 entries, 0 to 54\n",
      "Data columns (total 12 columns):\n",
      " #   Column              Non-Null Count  Dtype\n",
      "---  ------              --------------  -----\n",
      " 0   Year                55 non-null     int64\n",
      " 1   Population          55 non-null     int64\n",
      " 2   Total               55 non-null     int64\n",
      " 3   Violent             55 non-null     int64\n",
      " 4   Property            55 non-null     int64\n",
      " 5   Murder              55 non-null     int64\n",
      " 6   Forcible_Rape       55 non-null     int64\n",
      " 7   Robbery             55 non-null     int64\n",
      " 8   Aggravated_assault  55 non-null     int64\n",
      " 9   Burglary            55 non-null     int64\n",
      " 10  Larceny_Theft       55 non-null     int64\n",
      " 11  Vehicle_Theft       55 non-null     int64\n",
      "dtypes: int64(12)\n",
      "memory usage: 5.3 KB\n",
      "0    1960-01-01\n",
      "1    1961-01-01\n",
      "2    1962-01-01\n",
      "3    1963-01-01\n",
      "4    1964-01-01\n",
      "5    1965-01-01\n",
      "6    1966-01-01\n",
      "7    1967-01-01\n",
      "8    1968-01-01\n",
      "9    1969-01-01\n",
      "10   1970-01-01\n",
      "11   1971-01-01\n",
      "12   1972-01-01\n",
      "13   1973-01-01\n",
      "14   1974-01-01\n",
      "15   1975-01-01\n",
      "16   1976-01-01\n",
      "17   1977-01-01\n",
      "18   1978-01-01\n",
      "19   1979-01-01\n",
      "20   1980-01-01\n",
      "21   1981-01-01\n",
      "22   1982-01-01\n",
      "23   1983-01-01\n",
      "24   1984-01-01\n",
      "25   1985-01-01\n",
      "26   1986-01-01\n",
      "27   1987-01-01\n",
      "28   1988-01-01\n",
      "29   1989-01-01\n",
      "30   1990-01-01\n",
      "31   1991-01-01\n",
      "32   1992-01-01\n",
      "33   1993-01-01\n",
      "34   1994-01-01\n",
      "35   1995-01-01\n",
      "36   1996-01-01\n",
      "37   1997-01-01\n",
      "38   1998-01-01\n",
      "39   1999-01-01\n",
      "40   2000-01-01\n",
      "41   2001-01-01\n",
      "42   2002-01-01\n",
      "43   2003-01-01\n",
      "44   2004-01-01\n",
      "45   2005-01-01\n",
      "46   2006-01-01\n",
      "47   2007-01-01\n",
      "48   2008-01-01\n",
      "49   2009-01-01\n",
      "50   2010-01-01\n",
      "51   2011-01-01\n",
      "52   2012-01-01\n",
      "53   2013-01-01\n",
      "54   2014-01-01\n",
      "Name: Year, dtype: datetime64[ns]\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "path4 = \"exercise_data/US_Crime_Rates_1960_2014.csv\"\r\n",
    "\r\n",
    "crime = pd.read_csv(path4)\r\n",
    "crime\r\n",
    "crime.info()\r\n",
    "\r\n",
    "crime.Year = pd.to_datetime(crime.Year, format=\"%Y\")\r\n",
    "crime.Year.dtype\r\n",
    "print(crime.Year)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path4 = 'exercise_data/US_Crime_Rates_1960_2014.csv'    # \"US_Crime_Rates_1960_2014.csv\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据框命名为crime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Population</th>\n",
       "      <th>Total</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1960</td>\n",
       "      <td>179323175</td>\n",
       "      <td>3384200</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1961</td>\n",
       "      <td>182992000</td>\n",
       "      <td>3488000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1962</td>\n",
       "      <td>185771000</td>\n",
       "      <td>3752200</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1963</td>\n",
       "      <td>188483000</td>\n",
       "      <td>4109500</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1964</td>\n",
       "      <td>191141000</td>\n",
       "      <td>4564600</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Year  Population    Total  Violent  Property  Murder  Forcible_Rape  \\\n",
       "0  1960   179323175  3384200   288460   3095700    9110          17190   \n",
       "1  1961   182992000  3488000   289390   3198600    8740          17220   \n",
       "2  1962   185771000  3752200   301510   3450700    8530          17550   \n",
       "3  1963   188483000  4109500   316970   3792500    8640          17650   \n",
       "4  1964   191141000  4564600   364220   4200400    9360          21420   \n",
       "\n",
       "   Robbery  Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "0   107840              154320    912100        1855400         328200  \n",
       "1   106670              156760    949600        1913000         336000  \n",
       "2   110860              164570    994300        2089600         366800  \n",
       "3   116470              174210   1086400        2297800         408300  \n",
       "4   130390              203050   1213200        2514400         472800  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "crime = pd.read_csv(path4)\n",
    "crime.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 每一列(column)的数据类型是什么样的？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 55 entries, 0 to 54\n",
      "Data columns (total 12 columns):\n",
      " #   Column              Non-Null Count  Dtype\n",
      "---  ------              --------------  -----\n",
      " 0   Year                55 non-null     int64\n",
      " 1   Population          55 non-null     int64\n",
      " 2   Total               55 non-null     int64\n",
      " 3   Violent             55 non-null     int64\n",
      " 4   Property            55 non-null     int64\n",
      " 5   Murder              55 non-null     int64\n",
      " 6   Forcible_Rape       55 non-null     int64\n",
      " 7   Robbery             55 non-null     int64\n",
      " 8   Aggravated_assault  55 non-null     int64\n",
      " 9   Burglary            55 non-null     int64\n",
      " 10  Larceny_Theft       55 non-null     int64\n",
      " 11  Vehicle_Theft       55 non-null     int64\n",
      "dtypes: int64(12)\n",
      "memory usage: 5.3 KB\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "crime.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 55 entries, 0 to 54\n",
      "Data columns (total 12 columns):\n",
      " #   Column              Non-Null Count  Dtype\n",
      "---  ------              --------------  -----\n",
      " 0   Year                55 non-null     int64\n",
      " 1   Population          55 non-null     int64\n",
      " 2   Total               55 non-null     int64\n",
      " 3   Violent             55 non-null     int64\n",
      " 4   Property            55 non-null     int64\n",
      " 5   Murder              55 non-null     int64\n",
      " 6   Forcible_Rape       55 non-null     int64\n",
      " 7   Robbery             55 non-null     int64\n",
      " 8   Aggravated_assault  55 non-null     int64\n",
      " 9   Burglary            55 non-null     int64\n",
      " 10  Larceny_Theft       55 non-null     int64\n",
      " 11  Vehicle_Theft       55 non-null     int64\n",
      "dtypes: int64(12)\n",
      "memory usage: 5.3 KB\n"
     ]
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "crime.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "*注意到了吗，Year的数据类型为 ```int64```，但是pandas有一个不同的数据类型去处理时间序列(time series)，我们现在来看看。*"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 将Year的数据类型转换为 ```datetime64```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "datetime64[ns]\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "crime.Year = pd.to_datetime(crime.Year, format = \"%Y\")\r\n",
    "print(crime.Year.dtype)\r\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 55 entries, 0 to 54\n",
      "Data columns (total 12 columns):\n",
      " #   Column              Non-Null Count  Dtype         \n",
      "---  ------              --------------  -----         \n",
      " 0   Year                55 non-null     datetime64[ns]\n",
      " 1   Population          55 non-null     int64         \n",
      " 2   Total               55 non-null     int64         \n",
      " 3   Violent             55 non-null     int64         \n",
      " 4   Property            55 non-null     int64         \n",
      " 5   Murder              55 non-null     int64         \n",
      " 6   Forcible_Rape       55 non-null     int64         \n",
      " 7   Robbery             55 non-null     int64         \n",
      " 8   Aggravated_assault  55 non-null     int64         \n",
      " 9   Burglary            55 non-null     int64         \n",
      " 10  Larceny_Theft       55 non-null     int64         \n",
      " 11  Vehicle_Theft       55 non-null     int64         \n",
      "dtypes: datetime64[ns](1), int64(11)\n",
      "memory usage: 5.3 KB\n"
     ]
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "crime.Year = pd.to_datetime(crime.Year, format='%Y')\n",
    "crime.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 将列Year设置为数据框的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Total</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960-01-01</th>\n",
       "      <td>179323175</td>\n",
       "      <td>3384200</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>182992000</td>\n",
       "      <td>3488000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962-01-01</th>\n",
       "      <td>185771000</td>\n",
       "      <td>3752200</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963-01-01</th>\n",
       "      <td>188483000</td>\n",
       "      <td>4109500</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964-01-01</th>\n",
       "      <td>191141000</td>\n",
       "      <td>4564600</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Population    Total  Violent  Property  Murder  Forcible_Rape  \\\n",
       "Year                                                                        \n",
       "1960-01-01   179323175  3384200   288460   3095700    9110          17190   \n",
       "1961-01-01   182992000  3488000   289390   3198600    8740          17220   \n",
       "1962-01-01   185771000  3752200   301510   3450700    8530          17550   \n",
       "1963-01-01   188483000  4109500   316970   3792500    8640          17650   \n",
       "1964-01-01   191141000  4564600   364220   4200400    9360          21420   \n",
       "\n",
       "            Robbery  Aggravated_assault  Burglary  Larceny_Theft  \\\n",
       "Year                                                               \n",
       "1960-01-01   107840              154320    912100        1855400   \n",
       "1961-01-01   106670              156760    949600        1913000   \n",
       "1962-01-01   110860              164570    994300        2089600   \n",
       "1963-01-01   116470              174210   1086400        2297800   \n",
       "1964-01-01   130390              203050   1213200        2514400   \n",
       "\n",
       "            Vehicle_Theft  \n",
       "Year                       \n",
       "1960-01-01         328200  \n",
       "1961-01-01         336000  \n",
       "1962-01-01         366800  \n",
       "1963-01-01         408300  \n",
       "1964-01-01         472800  "
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "crime = crime.set_index(\"Year\")\r\n",
    "crime.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Total</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960</th>\n",
       "      <td>179323175</td>\n",
       "      <td>3384200</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961</th>\n",
       "      <td>182992000</td>\n",
       "      <td>3488000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962</th>\n",
       "      <td>185771000</td>\n",
       "      <td>3752200</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963</th>\n",
       "      <td>188483000</td>\n",
       "      <td>4109500</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964</th>\n",
       "      <td>191141000</td>\n",
       "      <td>4564600</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Population    Total  Violent  Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                           \n",
       "1960   179323175  3384200   288460   3095700    9110          17190   107840   \n",
       "1961   182992000  3488000   289390   3198600    8740          17220   106670   \n",
       "1962   185771000  3752200   301510   3450700    8530          17550   110860   \n",
       "1963   188483000  4109500   316970   3792500    8640          17650   116470   \n",
       "1964   191141000  4564600   364220   4200400    9360          21420   130390   \n",
       "\n",
       "      Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                              \n",
       "1960              154320    912100        1855400         328200  \n",
       "1961              156760    949600        1913000         336000  \n",
       "1962              164570    994300        2089600         366800  \n",
       "1963              174210   1086400        2297800         408300  \n",
       "1964              203050   1213200        2514400         472800  "
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "crime = crime.set_index('Year', drop = True)\n",
    "crime.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 删除名为Total的列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 55 entries, 1960 to 2014\n",
      "Data columns (total 10 columns):\n",
      " #   Column              Non-Null Count  Dtype\n",
      "---  ------              --------------  -----\n",
      " 0   Population          55 non-null     int64\n",
      " 1   Violent             55 non-null     int64\n",
      " 2   Property            55 non-null     int64\n",
      " 3   Murder              55 non-null     int64\n",
      " 4   Forcible_Rape       55 non-null     int64\n",
      " 5   Robbery             55 non-null     int64\n",
      " 6   Aggravated_assault  55 non-null     int64\n",
      " 7   Burglary            55 non-null     int64\n",
      " 8   Larceny_Theft       55 non-null     int64\n",
      " 9   Vehicle_Theft       55 non-null     int64\n",
      "dtypes: int64(10)\n",
      "memory usage: 7.2 KB\n",
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 55 entries, 1960 to 2014\n",
      "Data columns (total 10 columns):\n",
      " #   Column              Non-Null Count  Dtype\n",
      "---  ------              --------------  -----\n",
      " 0   Population          55 non-null     int64\n",
      " 1   Violent             55 non-null     int64\n",
      " 2   Property            55 non-null     int64\n",
      " 3   Murder              55 non-null     int64\n",
      " 4   Forcible_Rape       55 non-null     int64\n",
      " 5   Robbery             55 non-null     int64\n",
      " 6   Aggravated_assault  55 non-null     int64\n",
      " 7   Burglary            55 non-null     int64\n",
      " 8   Larceny_Theft       55 non-null     int64\n",
      " 9   Vehicle_Theft       55 non-null     int64\n",
      "dtypes: int64(10)\n",
      "memory usage: 7.2 KB\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960</th>\n",
       "      <td>179323175</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961</th>\n",
       "      <td>182992000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962</th>\n",
       "      <td>185771000</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963</th>\n",
       "      <td>188483000</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964</th>\n",
       "      <td>191141000</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Population  Violent  Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                  \n",
       "1960   179323175   288460   3095700    9110          17190   107840   \n",
       "1961   182992000   289390   3198600    8740          17220   106670   \n",
       "1962   185771000   301510   3450700    8530          17550   110860   \n",
       "1963   188483000   316970   3792500    8640          17650   116470   \n",
       "1964   191141000   364220   4200400    9360          21420   130390   \n",
       "\n",
       "      Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                              \n",
       "1960              154320    912100        1855400         328200  \n",
       "1961              156760    949600        1913000         336000  \n",
       "1962              164570    994300        2089600         366800  \n",
       "1963              174210   1086400        2297800         408300  \n",
       "1964              203050   1213200        2514400         472800  "
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "#del crime[\"Total\"]\r\n",
    "crime.info()\r\n",
    "#print(crime.head())\r\n",
    "#del crime[\"Total\"]\r\n",
    "crime.info()\r\n",
    "crime.head()\r\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960-01-01</th>\n",
       "      <td>179323175</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>182992000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962-01-01</th>\n",
       "      <td>185771000</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963-01-01</th>\n",
       "      <td>188483000</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964-01-01</th>\n",
       "      <td>191141000</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Population  Violent  Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                        \n",
       "1960-01-01   179323175   288460   3095700    9110          17190   107840   \n",
       "1961-01-01   182992000   289390   3198600    8740          17220   106670   \n",
       "1962-01-01   185771000   301510   3450700    8530          17550   110860   \n",
       "1963-01-01   188483000   316970   3792500    8640          17650   116470   \n",
       "1964-01-01   191141000   364220   4200400    9360          21420   130390   \n",
       "\n",
       "            Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                                    \n",
       "1960-01-01              154320    912100        1855400         328200  \n",
       "1961-01-01              156760    949600        1913000         336000  \n",
       "1962-01-01              164570    994300        2089600         366800  \n",
       "1963-01-01              174210   1086400        2297800         408300  \n",
       "1964-01-01              203050   1213200        2514400         472800  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "del crime['Total']\n",
    "crime.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "#csb_print_codes\r\n",
    "# 数据以W星期,M月,Q季度,QS季度的开始第一天开始,A年,10A十年,10AS十年聚合日期第一天开始.\r\n",
    "#年，季，月，日，分，秒 A,Q,M,D,T,S,AS,十年第一天"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960-01-01</th>\n",
       "      <td>1915053175</td>\n",
       "      <td>4134930</td>\n",
       "      <td>45160900</td>\n",
       "      <td>106180</td>\n",
       "      <td>236720</td>\n",
       "      <td>1633510</td>\n",
       "      <td>2158520</td>\n",
       "      <td>13321100</td>\n",
       "      <td>26547700</td>\n",
       "      <td>5292100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-01</th>\n",
       "      <td>2121193298</td>\n",
       "      <td>9607930</td>\n",
       "      <td>91383800</td>\n",
       "      <td>192230</td>\n",
       "      <td>554570</td>\n",
       "      <td>4159020</td>\n",
       "      <td>4702120</td>\n",
       "      <td>28486000</td>\n",
       "      <td>53157800</td>\n",
       "      <td>9739900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-01-01</th>\n",
       "      <td>2371370069</td>\n",
       "      <td>14074328</td>\n",
       "      <td>117048900</td>\n",
       "      <td>206439</td>\n",
       "      <td>865639</td>\n",
       "      <td>5383109</td>\n",
       "      <td>7619130</td>\n",
       "      <td>33073494</td>\n",
       "      <td>72040253</td>\n",
       "      <td>11935411</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-01-01</th>\n",
       "      <td>2612825258</td>\n",
       "      <td>17527048</td>\n",
       "      <td>119053499</td>\n",
       "      <td>211664</td>\n",
       "      <td>998827</td>\n",
       "      <td>5748930</td>\n",
       "      <td>10568963</td>\n",
       "      <td>26750015</td>\n",
       "      <td>77679366</td>\n",
       "      <td>14624418</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01</th>\n",
       "      <td>2947969117</td>\n",
       "      <td>13968056</td>\n",
       "      <td>100944369</td>\n",
       "      <td>163068</td>\n",
       "      <td>922499</td>\n",
       "      <td>4230366</td>\n",
       "      <td>8652124</td>\n",
       "      <td>21565176</td>\n",
       "      <td>67970291</td>\n",
       "      <td>11412834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-01</th>\n",
       "      <td>1570146307</td>\n",
       "      <td>6072017</td>\n",
       "      <td>44095950</td>\n",
       "      <td>72867</td>\n",
       "      <td>421059</td>\n",
       "      <td>1749809</td>\n",
       "      <td>3764142</td>\n",
       "      <td>10125170</td>\n",
       "      <td>30401698</td>\n",
       "      <td>3569080</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Population   Violent   Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                          \n",
       "1960-01-01  1915053175   4134930   45160900  106180         236720  1633510   \n",
       "1970-01-01  2121193298   9607930   91383800  192230         554570  4159020   \n",
       "1980-01-01  2371370069  14074328  117048900  206439         865639  5383109   \n",
       "1990-01-01  2612825258  17527048  119053499  211664         998827  5748930   \n",
       "2000-01-01  2947969117  13968056  100944369  163068         922499  4230366   \n",
       "2010-01-01  1570146307   6072017   44095950   72867         421059  1749809   \n",
       "\n",
       "            Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                                    \n",
       "1960-01-01             2158520  13321100       26547700        5292100  \n",
       "1970-01-01             4702120  28486000       53157800        9739900  \n",
       "1980-01-01             7619130  33073494       72040253       11935411  \n",
       "1990-01-01            10568963  26750015       77679366       14624418  \n",
       "2000-01-01             8652124  21565176       67970291       11412834  \n",
       "2010-01-01             3764142  10125170       30401698        3569080  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "crime.resample('10AS').sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 按照Year对数据框进行分组并求和 \n",
    "*注意Population这一列，若直接对其求和，是不正确的**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960-01-01</th>\n",
       "      <td>201385000</td>\n",
       "      <td>4134930</td>\n",
       "      <td>45160900</td>\n",
       "      <td>106180</td>\n",
       "      <td>236720</td>\n",
       "      <td>1633510</td>\n",
       "      <td>2158520</td>\n",
       "      <td>13321100</td>\n",
       "      <td>26547700</td>\n",
       "      <td>5292100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-01</th>\n",
       "      <td>220099000</td>\n",
       "      <td>9607930</td>\n",
       "      <td>91383800</td>\n",
       "      <td>192230</td>\n",
       "      <td>554570</td>\n",
       "      <td>4159020</td>\n",
       "      <td>4702120</td>\n",
       "      <td>28486000</td>\n",
       "      <td>53157800</td>\n",
       "      <td>9739900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-01-01</th>\n",
       "      <td>248239000</td>\n",
       "      <td>14074328</td>\n",
       "      <td>117048900</td>\n",
       "      <td>206439</td>\n",
       "      <td>865639</td>\n",
       "      <td>5383109</td>\n",
       "      <td>7619130</td>\n",
       "      <td>33073494</td>\n",
       "      <td>72040253</td>\n",
       "      <td>11935411</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1990-01-01</th>\n",
       "      <td>272690813</td>\n",
       "      <td>17527048</td>\n",
       "      <td>119053499</td>\n",
       "      <td>211664</td>\n",
       "      <td>998827</td>\n",
       "      <td>5748930</td>\n",
       "      <td>10568963</td>\n",
       "      <td>26750015</td>\n",
       "      <td>77679366</td>\n",
       "      <td>14624418</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2000-01-01</th>\n",
       "      <td>307006550</td>\n",
       "      <td>13968056</td>\n",
       "      <td>100944369</td>\n",
       "      <td>163068</td>\n",
       "      <td>922499</td>\n",
       "      <td>4230366</td>\n",
       "      <td>8652124</td>\n",
       "      <td>21565176</td>\n",
       "      <td>67970291</td>\n",
       "      <td>11412834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2010-01-01</th>\n",
       "      <td>318857056</td>\n",
       "      <td>6072017</td>\n",
       "      <td>44095950</td>\n",
       "      <td>72867</td>\n",
       "      <td>421059</td>\n",
       "      <td>1749809</td>\n",
       "      <td>3764142</td>\n",
       "      <td>10125170</td>\n",
       "      <td>30401698</td>\n",
       "      <td>3569080</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            Population   Violent   Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                          \n",
       "1960-01-01   201385000   4134930   45160900  106180         236720  1633510   \n",
       "1970-01-01   220099000   9607930   91383800  192230         554570  4159020   \n",
       "1980-01-01   248239000  14074328  117048900  206439         865639  5383109   \n",
       "1990-01-01   272690813  17527048  119053499  211664         998827  5748930   \n",
       "2000-01-01   307006550  13968056  100944369  163068         922499  4230366   \n",
       "2010-01-01   318857056   6072017   44095950   72867         421059  1749809   \n",
       "\n",
       "            Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                                    \n",
       "1960-01-01             2158520  13321100       26547700        5292100  \n",
       "1970-01-01             4702120  28486000       53157800        9739900  \n",
       "1980-01-01             7619130  33073494       72040253       11935411  \n",
       "1990-01-01            10568963  26750015       77679366       14624418  \n",
       "2000-01-01             8652124  21565176       67970291       11412834  \n",
       "2010-01-01             3764142  10125170       30401698        3569080  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 更多关于 .resample 的介绍\n",
    "# (https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.resample.html)\n",
    "# 更多关于 Offset Aliases的介绍 \n",
    "# (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases)\n",
    "# 运行以下代码\n",
    "crimes = crime.resample('10AS').sum() # resample a time series per decades\n",
    "\n",
    "\n",
    "# 用resample去得到“Population”列的最大值\n",
    "population = crime['Population'].resample('10AS').max()\n",
    "\n",
    "# 更新 \"Population\" \n",
    "crimes['Population'] = population\n",
    "\n",
    "crimes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 何时是美国历史上生存最危险的年代？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Violent</th>\n",
       "      <th>Property</th>\n",
       "      <th>Murder</th>\n",
       "      <th>Forcible_Rape</th>\n",
       "      <th>Robbery</th>\n",
       "      <th>Aggravated_assault</th>\n",
       "      <th>Burglary</th>\n",
       "      <th>Larceny_Theft</th>\n",
       "      <th>Vehicle_Theft</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Year</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1960</th>\n",
       "      <td>179323175</td>\n",
       "      <td>288460</td>\n",
       "      <td>3095700</td>\n",
       "      <td>9110</td>\n",
       "      <td>17190</td>\n",
       "      <td>107840</td>\n",
       "      <td>154320</td>\n",
       "      <td>912100</td>\n",
       "      <td>1855400</td>\n",
       "      <td>328200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961</th>\n",
       "      <td>182992000</td>\n",
       "      <td>289390</td>\n",
       "      <td>3198600</td>\n",
       "      <td>8740</td>\n",
       "      <td>17220</td>\n",
       "      <td>106670</td>\n",
       "      <td>156760</td>\n",
       "      <td>949600</td>\n",
       "      <td>1913000</td>\n",
       "      <td>336000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962</th>\n",
       "      <td>185771000</td>\n",
       "      <td>301510</td>\n",
       "      <td>3450700</td>\n",
       "      <td>8530</td>\n",
       "      <td>17550</td>\n",
       "      <td>110860</td>\n",
       "      <td>164570</td>\n",
       "      <td>994300</td>\n",
       "      <td>2089600</td>\n",
       "      <td>366800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963</th>\n",
       "      <td>188483000</td>\n",
       "      <td>316970</td>\n",
       "      <td>3792500</td>\n",
       "      <td>8640</td>\n",
       "      <td>17650</td>\n",
       "      <td>116470</td>\n",
       "      <td>174210</td>\n",
       "      <td>1086400</td>\n",
       "      <td>2297800</td>\n",
       "      <td>408300</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964</th>\n",
       "      <td>191141000</td>\n",
       "      <td>364220</td>\n",
       "      <td>4200400</td>\n",
       "      <td>9360</td>\n",
       "      <td>21420</td>\n",
       "      <td>130390</td>\n",
       "      <td>203050</td>\n",
       "      <td>1213200</td>\n",
       "      <td>2514400</td>\n",
       "      <td>472800</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      Population  Violent  Property  Murder  Forcible_Rape  Robbery  \\\n",
       "Year                                                                  \n",
       "1960   179323175   288460   3095700    9110          17190   107840   \n",
       "1961   182992000   289390   3198600    8740          17220   106670   \n",
       "1962   185771000   301510   3450700    8530          17550   110860   \n",
       "1963   188483000   316970   3792500    8640          17650   116470   \n",
       "1964   191141000   364220   4200400    9360          21420   130390   \n",
       "\n",
       "      Aggravated_assault  Burglary  Larceny_Theft  Vehicle_Theft  \n",
       "Year                                                              \n",
       "1960              154320    912100        1855400         328200  \n",
       "1961              156760    949600        1913000         336000  \n",
       "1962              164570    994300        2089600         366800  \n",
       "1963              174210   1086400        2297800         408300  \n",
       "1964              203050   1213200        2514400         472800  "
      ]
     },
     "execution_count": 84,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "#argmax()函数是求得一维数组的返回序号值\r\n",
    "#idxmax()函数返回的是二维数组返回的序号值\r\n",
    "crime.head()\r\n",
    "#crime.max(axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Population           2014-01-01\n",
       "Violent              1992-01-01\n",
       "Property             1991-01-01\n",
       "Murder               1991-01-01\n",
       "Forcible_Rape        1992-01-01\n",
       "Robbery              1991-01-01\n",
       "Aggravated_assault   1993-01-01\n",
       "Burglary             1980-01-01\n",
       "Larceny_Theft        1991-01-01\n",
       "Vehicle_Theft        1991-01-01\n",
       "dtype: datetime64[ns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "crime.idxmax(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习5-合并\n",
    "## 探索虚拟姓名数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  name sbject_id\n",
      "1  csb         1\n",
      "2   zb         2\n",
      "3  fzm         3\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "rawdata = {\r\n",
    "        \"name\":[\"csb\", \"zb\", \"fzm\"],\r\n",
    "        \"sbject_id\":[\"1\", \"2\", \"3\"]\r\n",
    "        }\r\n",
    "data = pd.DataFrame(rawdata, index = [1,2,3])\r\n",
    "print(data)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 按照如下的元数据内容创建数据框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>firstname</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>csb</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>fzm</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>bb</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>qq</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id firstname\n",
       "0          1       csb\n",
       "1          2       fzm\n",
       "2          3        bb\n",
       "3          4        qq"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "raw_data_1 = {\r\n",
    "        \"subject_id\":[\"1\", \"2\", \"3\", \"4\"],\r\n",
    "        \"firstname\":[\"csb\", \"fzm\", \"bb\", \"qq\"]}\r\n",
    "dataframe1 = pd.DataFrame(raw_data_1, columns=[\"subject_id\", \"firstname\"])        \r\n",
    "dataframe1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "raw_data_1 = {\n",
    "        'subject_id': ['1', '2', '3', '4', '5'],\n",
    "        'first_name': ['Alex', 'Amy', 'Allen', 'Alice', 'Ayoung'], \n",
    "        'last_name': ['Anderson', 'Ackerman', 'Ali', 'Aoni', 'Atiches']}\n",
    "\n",
    "raw_data_2 = {\n",
    "        'subject_id': ['4', '5', '6', '7', '8'],\n",
    "        'first_name': ['Billy', 'Brian', 'Bran', 'Bryce', 'Betty'], \n",
    "        'last_name': ['Bonder', 'Black', 'Balwner', 'Brice', 'Btisan']}\n",
    "\n",
    "raw_data_3 = {\n",
    "        'subject_id': ['1', '2', '3', '4', '5', '7', '8', '9', '10', '11'],\n",
    "        'test_id': [51, 15, 15, 61, 16, 14, 15, 1, 61, 16]}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将上述的数据框分别命名为```data1, data2, data3```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  subject_id first_name last_name\n",
      "0          1       Alex  Anderson\n",
      "1          2        Amy  Ackerman\n",
      "2          3      Allen       Ali\n",
      "3          4      Alice      Aoni\n",
      "4          5     Ayoung   Atiches\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name last_name\n",
      "0          4      Billy    Bonder\n",
      "1          5      Brian     Black\n",
      "2          6       Bran   Balwner\n",
      "3          7      Bryce     Brice\n",
      "4          8      Betty    Btisan\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id  test_id\n",
      "0          1       51\n",
      "1          2       15\n",
      "2          3       15\n",
      "3          4       61\n",
      "4          5       16\n",
      "5          7       14\n",
      "6          8       15\n",
      "7          9        1\n",
      "8         10       61\n",
      "9         11       16\n",
      "----------------------------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data1 = pd.DataFrame(raw_data_1, columns = ['subject_id', 'first_name', 'last_name'])\n",
    "data2 = pd.DataFrame(raw_data_2, columns = ['subject_id', 'first_name', 'last_name'])\n",
    "data3 = pd.DataFrame(raw_data_3, columns = ['subject_id','test_id'])\n",
    "print(data1)\n",
    "print(\"-\"*100)\n",
    "print(data2)\n",
    "print(\"-\"*100)\n",
    "print(data3)\n",
    "print(\"-\"*100)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 将```data1```和```data2```两个数据框按照行的维度进行合并，命名为```all_data```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  subject_id first_name last_name\n",
      "0          1       Alex  Anderson\n",
      "1          2        Amy  Ackerman\n",
      "2          3      Allen       Ali\n",
      "3          4      Alice      Aoni\n",
      "4          5     Ayoung   Atiches\n",
      "0          4      Billy    Bonder\n",
      "1          5      Brian     Black\n",
      "2          6       Bran   Balwner\n",
      "3          7      Bryce     Brice\n",
      "4          8      Betty    Btisan\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name last_name subject_id first_name last_name\n",
      "0          1       Alex  Anderson          4      Billy    Bonder\n",
      "1          2        Amy  Ackerman          5      Brian     Black\n",
      "2          3      Allen       Ali          6       Bran   Balwner\n",
      "3          4      Alice      Aoni          7      Bryce     Brice\n",
      "4          5     Ayoung   Atiches          8      Betty    Btisan\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "all_data = pd.concat([data1, data2],axis=0) #按照行的维度合并\r\n",
    "print(all_data)\r\n",
    "print(\"-\"*100)\r\n",
    "all_data_col = pd.concat([data1, data2],axis=1) #按照列的维度进行合并\r\n",
    "print(all_data_col)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Alex</td>\n",
       "      <td>Anderson</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Amy</td>\n",
       "      <td>Ackerman</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Allen</td>\n",
       "      <td>Ali</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>6</td>\n",
       "      <td>Bran</td>\n",
       "      <td>Balwner</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7</td>\n",
       "      <td>Bryce</td>\n",
       "      <td>Brice</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8</td>\n",
       "      <td>Betty</td>\n",
       "      <td>Btisan</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name last_name\n",
       "0          1       Alex  Anderson\n",
       "1          2        Amy  Ackerman\n",
       "2          3      Allen       Ali\n",
       "3          4      Alice      Aoni\n",
       "4          5     Ayoung   Atiches\n",
       "0          4      Billy    Bonder\n",
       "1          5      Brian     Black\n",
       "2          6       Bran   Balwner\n",
       "3          7      Bryce     Brice\n",
       "4          8      Betty    Btisan"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "all_data = pd.concat([data1, data2])\n",
    "all_data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 将```data1```和```data2```两个数据框按照列的维度进行合并，命名为```all_data_col```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Alex</td>\n",
       "      <td>Anderson</td>\n",
       "      <td>4</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Amy</td>\n",
       "      <td>Ackerman</td>\n",
       "      <td>5</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Allen</td>\n",
       "      <td>Ali</td>\n",
       "      <td>6</td>\n",
       "      <td>Bran</td>\n",
       "      <td>Balwner</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "      <td>7</td>\n",
       "      <td>Bryce</td>\n",
       "      <td>Brice</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "      <td>8</td>\n",
       "      <td>Betty</td>\n",
       "      <td>Btisan</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name last_name subject_id first_name last_name\n",
       "0          1       Alex  Anderson          4      Billy    Bonder\n",
       "1          2        Amy  Ackerman          5      Brian     Black\n",
       "2          3      Allen       Ali          6       Bran   Balwner\n",
       "3          4      Alice      Aoni          7      Bryce     Brice\n",
       "4          5     Ayoung   Atiches          8      Betty    Btisan"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "all_data_col = pd.concat([data1, data2], axis = 1)\n",
    "all_data_col"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 打印```data3```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>test_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>7</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>8</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>10</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>11</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id  test_id\n",
       "0          1       51\n",
       "1          2       15\n",
       "2          3       15\n",
       "3          4       61\n",
       "4          5       16\n",
       "5          7       14\n",
       "6          8       15\n",
       "7          9        1\n",
       "8         10       61\n",
       "9         11       16"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 按照```subject_id```的值对```all_data```和```data3```作合并"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>test_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Alex</td>\n",
       "      <td>Anderson</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Amy</td>\n",
       "      <td>Ackerman</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Allen</td>\n",
       "      <td>Ali</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>5</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>7</td>\n",
       "      <td>Bryce</td>\n",
       "      <td>Brice</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8</td>\n",
       "      <td>Betty</td>\n",
       "      <td>Btisan</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name last_name  test_id\n",
       "0          1       Alex  Anderson       51\n",
       "1          2        Amy  Ackerman       15\n",
       "2          3      Allen       Ali       15\n",
       "3          4      Alice      Aoni       61\n",
       "4          4      Billy    Bonder       61\n",
       "5          5     Ayoung   Atiches       16\n",
       "6          5      Brian     Black       16\n",
       "7          7      Bryce     Brice       14\n",
       "8          8      Betty    Btisan       15"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "pd.merge(all_data, data3, on = \"subject_id\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name</th>\n",
       "      <th>last_name</th>\n",
       "      <th>test_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Alex</td>\n",
       "      <td>Anderson</td>\n",
       "      <td>51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Amy</td>\n",
       "      <td>Ackerman</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Allen</td>\n",
       "      <td>Ali</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "      <td>61</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>5</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>7</td>\n",
       "      <td>Bryce</td>\n",
       "      <td>Brice</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>8</td>\n",
       "      <td>Betty</td>\n",
       "      <td>Btisan</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name last_name  test_id\n",
       "0          1       Alex  Anderson       51\n",
       "1          2        Amy  Ackerman       15\n",
       "2          3      Allen       Ali       15\n",
       "3          4      Alice      Aoni       61\n",
       "4          4      Billy    Bonder       61\n",
       "5          5     Ayoung   Atiches       16\n",
       "6          5      Brian     Black       16\n",
       "7          7      Bryce     Brice       14\n",
       "8          8      Betty    Btisan       15"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pd.merge(all_data, data3, on='subject_id')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 对```data1```和```data2```按照```subject_id```作连接"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  subject_id first_name last_name\n",
      "0          1       Alex  Anderson\n",
      "1          2        Amy  Ackerman\n",
      "2          3      Allen       Ali\n",
      "3          4      Alice      Aoni\n",
      "4          5     Ayoung   Atiches\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name last_name\n",
      "0          4      Billy    Bonder\n",
      "1          5      Brian     Black\n",
      "2          6       Bran   Balwner\n",
      "3          7      Bryce     Brice\n",
      "4          8      Betty    Btisan\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
      "0          4        Alice        Aoni        Billy      Bonder\n",
      "1          5       Ayoung     Atiches        Brian       Black\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
      "0          1         Alex    Anderson          NaN         NaN\n",
      "1          2          Amy    Ackerman          NaN         NaN\n",
      "2          3        Allen         Ali          NaN         NaN\n",
      "3          4        Alice        Aoni        Billy      Bonder\n",
      "4          5       Ayoung     Atiches        Brian       Black\n",
      "5          6          NaN         NaN         Bran     Balwner\n",
      "6          7          NaN         NaN        Bryce       Brice\n",
      "7          8          NaN         NaN        Betty      Btisan\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
      "0          4        Alice        Aoni        Billy      Bonder\n",
      "1          5       Ayoung     Atiches        Brian       Black\n",
      "2          6          NaN         NaN         Bran     Balwner\n",
      "3          7          NaN         NaN        Bryce       Brice\n",
      "4          8          NaN         NaN        Betty      Btisan\n",
      "----------------------------------------------------------------------------------------------------\n",
      "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
      "0          1         Alex    Anderson          NaN         NaN\n",
      "1          2          Amy    Ackerman          NaN         NaN\n",
      "2          3        Allen         Ali          NaN         NaN\n",
      "3          4        Alice        Aoni        Billy      Bonder\n",
      "4          5       Ayoung     Atiches        Brian       Black\n",
      "----------------------------------------------------------------------------------------------------\n"
     ]
    }
   ],
   "source": [
    "#csb_print_codes\r\n",
    "print(data1)\r\n",
    "print(\"-\"*100)\r\n",
    "print(data2)\r\n",
    "print(\"-\"*100)\r\n",
    "\r\n",
    "merge_data1 = pd.merge(data1, data2, on = \"subject_id\", how = \"inner\")\r\n",
    "print(merge_data1)\r\n",
    "print(\"-\"*100)\r\n",
    "merge_data2 = pd.merge(data1, data2, on = \"subject_id\", how = \"outer\")\r\n",
    "print(merge_data2)\r\n",
    "print(\"-\"*100)\r\n",
    "merge_data3 = pd.merge(data1, data2, on = \"subject_id\", how = \"right\")\r\n",
    "print(merge_data3)\r\n",
    "print(\"-\"*100)\r\n",
    "merge_data4 = pd.merge(data1, data2, on = \"subject_id\", how = \"left\")\r\n",
    "print(merge_data4)\r\n",
    "print(\"-\"*100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name_x</th>\n",
       "      <th>last_name_x</th>\n",
       "      <th>first_name_y</th>\n",
       "      <th>last_name_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
       "0          4        Alice        Aoni        Billy      Bonder\n",
       "1          5       Ayoung     Atiches        Brian       Black"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pd.merge(data1, data2, on='subject_id', how='inner')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 找到 ```data1``` 和 ```data2``` 合并之后的所有匹配结果"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>subject_id</th>\n",
       "      <th>first_name_x</th>\n",
       "      <th>last_name_x</th>\n",
       "      <th>first_name_y</th>\n",
       "      <th>last_name_y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Alex</td>\n",
       "      <td>Anderson</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Amy</td>\n",
       "      <td>Ackerman</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Allen</td>\n",
       "      <td>Ali</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Alice</td>\n",
       "      <td>Aoni</td>\n",
       "      <td>Billy</td>\n",
       "      <td>Bonder</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Ayoung</td>\n",
       "      <td>Atiches</td>\n",
       "      <td>Brian</td>\n",
       "      <td>Black</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Bran</td>\n",
       "      <td>Balwner</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Bryce</td>\n",
       "      <td>Brice</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Betty</td>\n",
       "      <td>Btisan</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  subject_id first_name_x last_name_x first_name_y last_name_y\n",
       "0          1         Alex    Anderson          NaN         NaN\n",
       "1          2          Amy    Ackerman          NaN         NaN\n",
       "2          3        Allen         Ali          NaN         NaN\n",
       "3          4        Alice        Aoni        Billy      Bonder\n",
       "4          5       Ayoung     Atiches        Brian       Black\n",
       "5          6          NaN         NaN         Bran     Balwner\n",
       "6          7          NaN         NaN        Bryce       Brice\n",
       "7          8          NaN         NaN        Betty      Btisan"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pd.merge(data1, data2, on='subject_id', how='outer')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习6-统计\n",
    "## 风速数据\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd\n",
    "import datetime"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 从以下地址导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path6 = \"exercise_data/wind.data\"  # wind.data"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据作存储并且设置前三列为合适的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import datetime"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th>RPT</th>\n",
       "      <th>VAL</th>\n",
       "      <th>ROS</th>\n",
       "      <th>KIL</th>\n",
       "      <th>SHA</th>\n",
       "      <th>BIR</th>\n",
       "      <th>DUB</th>\n",
       "      <th>CLA</th>\n",
       "      <th>MUL</th>\n",
       "      <th>CLO</th>\n",
       "      <th>BEL</th>\n",
       "      <th>MAL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2061-01-01</td>\n",
       "      <td>15.04</td>\n",
       "      <td>14.96</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.87</td>\n",
       "      <td>13.67</td>\n",
       "      <td>10.25</td>\n",
       "      <td>10.83</td>\n",
       "      <td>12.58</td>\n",
       "      <td>18.50</td>\n",
       "      <td>15.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2061-01-02</td>\n",
       "      <td>14.71</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.83</td>\n",
       "      <td>6.50</td>\n",
       "      <td>12.62</td>\n",
       "      <td>7.67</td>\n",
       "      <td>11.50</td>\n",
       "      <td>10.04</td>\n",
       "      <td>9.79</td>\n",
       "      <td>9.67</td>\n",
       "      <td>17.54</td>\n",
       "      <td>13.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2061-01-03</td>\n",
       "      <td>18.50</td>\n",
       "      <td>16.88</td>\n",
       "      <td>12.33</td>\n",
       "      <td>10.13</td>\n",
       "      <td>11.17</td>\n",
       "      <td>6.17</td>\n",
       "      <td>11.25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.50</td>\n",
       "      <td>7.67</td>\n",
       "      <td>12.75</td>\n",
       "      <td>12.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2061-01-04</td>\n",
       "      <td>10.58</td>\n",
       "      <td>6.63</td>\n",
       "      <td>11.75</td>\n",
       "      <td>4.58</td>\n",
       "      <td>4.54</td>\n",
       "      <td>2.88</td>\n",
       "      <td>8.63</td>\n",
       "      <td>1.79</td>\n",
       "      <td>5.83</td>\n",
       "      <td>5.88</td>\n",
       "      <td>5.46</td>\n",
       "      <td>10.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2061-01-05</td>\n",
       "      <td>13.33</td>\n",
       "      <td>13.25</td>\n",
       "      <td>11.42</td>\n",
       "      <td>6.17</td>\n",
       "      <td>10.71</td>\n",
       "      <td>8.21</td>\n",
       "      <td>11.92</td>\n",
       "      <td>6.54</td>\n",
       "      <td>10.92</td>\n",
       "      <td>10.34</td>\n",
       "      <td>12.92</td>\n",
       "      <td>11.83</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Yr_Mo_Dy    RPT    VAL    ROS    KIL    SHA   BIR    DUB    CLA    MUL  \\\n",
       "0 2061-01-01  15.04  14.96  13.17   9.29    NaN  9.87  13.67  10.25  10.83   \n",
       "1 2061-01-02  14.71    NaN  10.83   6.50  12.62  7.67  11.50  10.04   9.79   \n",
       "2 2061-01-03  18.50  16.88  12.33  10.13  11.17  6.17  11.25    NaN   8.50   \n",
       "3 2061-01-04  10.58   6.63  11.75   4.58   4.54  2.88   8.63   1.79   5.83   \n",
       "4 2061-01-05  13.33  13.25  11.42   6.17  10.71  8.21  11.92   6.54  10.92   \n",
       "\n",
       "     CLO    BEL    MAL  \n",
       "0  12.58  18.50  15.04  \n",
       "1   9.67  17.54  13.83  \n",
       "2   7.67  12.75  12.71  \n",
       "3   5.88   5.46  10.88  \n",
       "4  10.34  12.92  11.83  "
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data = pd.read_table(path6, sep = \"\\s+\", parse_dates = [[0,1,2]]) \n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 2061年？我们真的有这一年的数据？创建一个函数并用它去修复这个bug"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th>RPT</th>\n",
       "      <th>VAL</th>\n",
       "      <th>ROS</th>\n",
       "      <th>KIL</th>\n",
       "      <th>SHA</th>\n",
       "      <th>BIR</th>\n",
       "      <th>DUB</th>\n",
       "      <th>CLA</th>\n",
       "      <th>MUL</th>\n",
       "      <th>CLO</th>\n",
       "      <th>BEL</th>\n",
       "      <th>MAL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1961-01-01</td>\n",
       "      <td>15.04</td>\n",
       "      <td>14.96</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.87</td>\n",
       "      <td>13.67</td>\n",
       "      <td>10.25</td>\n",
       "      <td>10.83</td>\n",
       "      <td>12.58</td>\n",
       "      <td>18.50</td>\n",
       "      <td>15.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1961-01-02</td>\n",
       "      <td>14.71</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.83</td>\n",
       "      <td>6.50</td>\n",
       "      <td>12.62</td>\n",
       "      <td>7.67</td>\n",
       "      <td>11.50</td>\n",
       "      <td>10.04</td>\n",
       "      <td>9.79</td>\n",
       "      <td>9.67</td>\n",
       "      <td>17.54</td>\n",
       "      <td>13.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1961-01-03</td>\n",
       "      <td>18.50</td>\n",
       "      <td>16.88</td>\n",
       "      <td>12.33</td>\n",
       "      <td>10.13</td>\n",
       "      <td>11.17</td>\n",
       "      <td>6.17</td>\n",
       "      <td>11.25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.50</td>\n",
       "      <td>7.67</td>\n",
       "      <td>12.75</td>\n",
       "      <td>12.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1961-01-04</td>\n",
       "      <td>10.58</td>\n",
       "      <td>6.63</td>\n",
       "      <td>11.75</td>\n",
       "      <td>4.58</td>\n",
       "      <td>4.54</td>\n",
       "      <td>2.88</td>\n",
       "      <td>8.63</td>\n",
       "      <td>1.79</td>\n",
       "      <td>5.83</td>\n",
       "      <td>5.88</td>\n",
       "      <td>5.46</td>\n",
       "      <td>10.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1961-01-05</td>\n",
       "      <td>13.33</td>\n",
       "      <td>13.25</td>\n",
       "      <td>11.42</td>\n",
       "      <td>6.17</td>\n",
       "      <td>10.71</td>\n",
       "      <td>8.21</td>\n",
       "      <td>11.92</td>\n",
       "      <td>6.54</td>\n",
       "      <td>10.92</td>\n",
       "      <td>10.34</td>\n",
       "      <td>12.92</td>\n",
       "      <td>11.83</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     Yr_Mo_Dy    RPT    VAL    ROS    KIL    SHA   BIR    DUB    CLA    MUL  \\\n",
       "0  1961-01-01  15.04  14.96  13.17   9.29    NaN  9.87  13.67  10.25  10.83   \n",
       "1  1961-01-02  14.71    NaN  10.83   6.50  12.62  7.67  11.50  10.04   9.79   \n",
       "2  1961-01-03  18.50  16.88  12.33  10.13  11.17  6.17  11.25    NaN   8.50   \n",
       "3  1961-01-04  10.58   6.63  11.75   4.58   4.54  2.88   8.63   1.79   5.83   \n",
       "4  1961-01-05  13.33  13.25  11.42   6.17  10.71  8.21  11.92   6.54  10.92   \n",
       "\n",
       "     CLO    BEL    MAL  \n",
       "0  12.58  18.50  15.04  \n",
       "1   9.67  17.54  13.83  \n",
       "2   7.67  12.75  12.71  \n",
       "3   5.88   5.46  10.88  \n",
       "4  10.34  12.92  11.83  "
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "def fix_century(x):\n",
    "    year = x.year - 100 if x.year > 1989 else x.year\n",
    "    return datetime.date(year, x.month, x.day)\n",
    "\n",
    "# apply the function fix_century on the column and replace the values to the right ones\n",
    "data['Yr_Mo_Dy'] = data['Yr_Mo_Dy'].apply(fix_century)\n",
    "\n",
    "# data.info()\n",
    "data.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 将日期设为索引，注意数据类型，应该是```datetime64[ns]```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RPT</th>\n",
       "      <th>VAL</th>\n",
       "      <th>ROS</th>\n",
       "      <th>KIL</th>\n",
       "      <th>SHA</th>\n",
       "      <th>BIR</th>\n",
       "      <th>DUB</th>\n",
       "      <th>CLA</th>\n",
       "      <th>MUL</th>\n",
       "      <th>CLO</th>\n",
       "      <th>BEL</th>\n",
       "      <th>MAL</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>15.04</td>\n",
       "      <td>14.96</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.87</td>\n",
       "      <td>13.67</td>\n",
       "      <td>10.25</td>\n",
       "      <td>10.83</td>\n",
       "      <td>12.58</td>\n",
       "      <td>18.50</td>\n",
       "      <td>15.04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-02</th>\n",
       "      <td>14.71</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.83</td>\n",
       "      <td>6.50</td>\n",
       "      <td>12.62</td>\n",
       "      <td>7.67</td>\n",
       "      <td>11.50</td>\n",
       "      <td>10.04</td>\n",
       "      <td>9.79</td>\n",
       "      <td>9.67</td>\n",
       "      <td>17.54</td>\n",
       "      <td>13.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-03</th>\n",
       "      <td>18.50</td>\n",
       "      <td>16.88</td>\n",
       "      <td>12.33</td>\n",
       "      <td>10.13</td>\n",
       "      <td>11.17</td>\n",
       "      <td>6.17</td>\n",
       "      <td>11.25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8.50</td>\n",
       "      <td>7.67</td>\n",
       "      <td>12.75</td>\n",
       "      <td>12.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-04</th>\n",
       "      <td>10.58</td>\n",
       "      <td>6.63</td>\n",
       "      <td>11.75</td>\n",
       "      <td>4.58</td>\n",
       "      <td>4.54</td>\n",
       "      <td>2.88</td>\n",
       "      <td>8.63</td>\n",
       "      <td>1.79</td>\n",
       "      <td>5.83</td>\n",
       "      <td>5.88</td>\n",
       "      <td>5.46</td>\n",
       "      <td>10.88</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-05</th>\n",
       "      <td>13.33</td>\n",
       "      <td>13.25</td>\n",
       "      <td>11.42</td>\n",
       "      <td>6.17</td>\n",
       "      <td>10.71</td>\n",
       "      <td>8.21</td>\n",
       "      <td>11.92</td>\n",
       "      <td>6.54</td>\n",
       "      <td>10.92</td>\n",
       "      <td>10.34</td>\n",
       "      <td>12.92</td>\n",
       "      <td>11.83</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              RPT    VAL    ROS    KIL    SHA   BIR    DUB    CLA    MUL  \\\n",
       "Yr_Mo_Dy                                                                   \n",
       "1961-01-01  15.04  14.96  13.17   9.29    NaN  9.87  13.67  10.25  10.83   \n",
       "1961-01-02  14.71    NaN  10.83   6.50  12.62  7.67  11.50  10.04   9.79   \n",
       "1961-01-03  18.50  16.88  12.33  10.13  11.17  6.17  11.25    NaN   8.50   \n",
       "1961-01-04  10.58   6.63  11.75   4.58   4.54  2.88   8.63   1.79   5.83   \n",
       "1961-01-05  13.33  13.25  11.42   6.17  10.71  8.21  11.92   6.54  10.92   \n",
       "\n",
       "              CLO    BEL    MAL  \n",
       "Yr_Mo_Dy                         \n",
       "1961-01-01  12.58  18.50  15.04  \n",
       "1961-01-02   9.67  17.54  13.83  \n",
       "1961-01-03   7.67  12.75  12.71  \n",
       "1961-01-04   5.88   5.46  10.88  \n",
       "1961-01-05  10.34  12.92  11.83  "
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# transform Yr_Mo_Dy it to date type datetime64\n",
    "data[\"Yr_Mo_Dy\"] = pd.to_datetime(data[\"Yr_Mo_Dy\"])\n",
    "\n",
    "# set 'Yr_Mo_Dy' as the index\n",
    "data = data.set_index('Yr_Mo_Dy')\n",
    "\n",
    "data.head()\n",
    "# data.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 对应每一个location，一共有多少数据值缺失"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RPT    6\n",
       "VAL    3\n",
       "ROS    2\n",
       "KIL    5\n",
       "SHA    2\n",
       "BIR    0\n",
       "DUB    3\n",
       "CLA    2\n",
       "MUL    3\n",
       "CLO    1\n",
       "BEL    0\n",
       "MAL    4\n",
       "dtype: int64"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data.isnull().sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 对应每一个location，一共有多少完整的数据值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RPT    6568\n",
       "VAL    6571\n",
       "ROS    6572\n",
       "KIL    6569\n",
       "SHA    6572\n",
       "BIR    6574\n",
       "DUB    6571\n",
       "CLA    6572\n",
       "MUL    6571\n",
       "CLO    6573\n",
       "BEL    6574\n",
       "MAL    6570\n",
       "dtype: int64"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data.shape[0] - data.isnull().sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 对于全体数据，计算风速的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10.227982360836924"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data.mean().mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10.227982360836924\n"
     ]
    }
   ],
   "source": [
    "print(data.mean().mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 创建一个名为```loc_stats```的数据框去计算并存储每个location的风速最小值，最大值，平均值和标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>RPT</th>\n",
       "      <td>0.67</td>\n",
       "      <td>35.80</td>\n",
       "      <td>12.362987</td>\n",
       "      <td>5.618413</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VAL</th>\n",
       "      <td>0.21</td>\n",
       "      <td>33.37</td>\n",
       "      <td>10.644314</td>\n",
       "      <td>5.267356</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ROS</th>\n",
       "      <td>1.50</td>\n",
       "      <td>33.84</td>\n",
       "      <td>11.660526</td>\n",
       "      <td>5.008450</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>KIL</th>\n",
       "      <td>0.00</td>\n",
       "      <td>28.46</td>\n",
       "      <td>6.306468</td>\n",
       "      <td>3.605811</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SHA</th>\n",
       "      <td>0.13</td>\n",
       "      <td>37.54</td>\n",
       "      <td>10.455834</td>\n",
       "      <td>4.936125</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BIR</th>\n",
       "      <td>0.00</td>\n",
       "      <td>26.16</td>\n",
       "      <td>7.092254</td>\n",
       "      <td>3.968683</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DUB</th>\n",
       "      <td>0.00</td>\n",
       "      <td>30.37</td>\n",
       "      <td>9.797343</td>\n",
       "      <td>4.977555</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CLA</th>\n",
       "      <td>0.00</td>\n",
       "      <td>31.08</td>\n",
       "      <td>8.495053</td>\n",
       "      <td>4.499449</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MUL</th>\n",
       "      <td>0.00</td>\n",
       "      <td>25.88</td>\n",
       "      <td>8.493590</td>\n",
       "      <td>4.166872</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>CLO</th>\n",
       "      <td>0.04</td>\n",
       "      <td>28.21</td>\n",
       "      <td>8.707332</td>\n",
       "      <td>4.503954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BEL</th>\n",
       "      <td>0.13</td>\n",
       "      <td>42.38</td>\n",
       "      <td>13.121007</td>\n",
       "      <td>5.835037</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MAL</th>\n",
       "      <td>0.67</td>\n",
       "      <td>42.54</td>\n",
       "      <td>15.599079</td>\n",
       "      <td>6.699794</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      min    max       mean       std\n",
       "RPT  0.67  35.80  12.362987  5.618413\n",
       "VAL  0.21  33.37  10.644314  5.267356\n",
       "ROS  1.50  33.84  11.660526  5.008450\n",
       "KIL  0.00  28.46   6.306468  3.605811\n",
       "SHA  0.13  37.54  10.455834  4.936125\n",
       "BIR  0.00  26.16   7.092254  3.968683\n",
       "DUB  0.00  30.37   9.797343  4.977555\n",
       "CLA  0.00  31.08   8.495053  4.499449\n",
       "MUL  0.00  25.88   8.493590  4.166872\n",
       "CLO  0.04  28.21   8.707332  4.503954\n",
       "BEL  0.13  42.38  13.121007  5.835037\n",
       "MAL  0.67  42.54  15.599079  6.699794"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "loc_stats = pd.DataFrame()\n",
    "\n",
    "loc_stats['min'] = data.min() # min\n",
    "loc_stats['max'] = data.max() # max \n",
    "loc_stats['mean'] = data.mean() # mean\n",
    "loc_stats['std'] = data.std() # standard deviations\n",
    "\n",
    "loc_stats"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤10 创建一个名为```day_stats```的数据框去计算并存储所有location的风速最小值，最大值，平均值和标准差"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>min</th>\n",
       "      <th>max</th>\n",
       "      <th>mean</th>\n",
       "      <th>std</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>9.29</td>\n",
       "      <td>18.50</td>\n",
       "      <td>13.018182</td>\n",
       "      <td>2.808875</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-02</th>\n",
       "      <td>6.50</td>\n",
       "      <td>17.54</td>\n",
       "      <td>11.336364</td>\n",
       "      <td>3.188994</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-03</th>\n",
       "      <td>6.17</td>\n",
       "      <td>18.50</td>\n",
       "      <td>11.641818</td>\n",
       "      <td>3.681912</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-04</th>\n",
       "      <td>1.79</td>\n",
       "      <td>11.75</td>\n",
       "      <td>6.619167</td>\n",
       "      <td>3.198126</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-01-05</th>\n",
       "      <td>6.17</td>\n",
       "      <td>13.33</td>\n",
       "      <td>10.630000</td>\n",
       "      <td>2.445356</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             min    max       mean       std\n",
       "Yr_Mo_Dy                                    \n",
       "1961-01-01  9.29  18.50  13.018182  2.808875\n",
       "1961-01-02  6.50  17.54  11.336364  3.188994\n",
       "1961-01-03  6.17  18.50  11.641818  3.681912\n",
       "1961-01-04  1.79  11.75   6.619167  3.198126\n",
       "1961-01-05  6.17  13.33  10.630000  2.445356"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# create the dataframe\n",
    "day_stats = pd.DataFrame()\n",
    "\n",
    "# this time we determine axis equals to one so it gets each row.\n",
    "day_stats['min'] = data.min(axis = 1) # min\n",
    "day_stats['max'] = data.max(axis = 1) # max \n",
    "day_stats['mean'] = data.mean(axis = 1) # mean\n",
    "day_stats['std'] = data.std(axis = 1) # standard deviations\n",
    "\n",
    "day_stats.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤11 对于每一个location，计算一月份的平均风速\n",
    "*注意，1961年的1月和1962年的1月应该区别对待*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RPT    14.847325\n",
       "VAL    12.914560\n",
       "ROS    13.299624\n",
       "KIL     7.199498\n",
       "SHA    11.667734\n",
       "BIR     8.054839\n",
       "DUB    11.819355\n",
       "CLA     9.512047\n",
       "MUL     9.543208\n",
       "CLO    10.053566\n",
       "BEL    14.550520\n",
       "MAL    18.028763\n",
       "dtype: float64"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# creates a new column 'date' and gets the values from the index\n",
    "data['date'] = data.index\n",
    "\n",
    "# creates a column for each value from date\n",
    "data['month'] = data['date'].apply(lambda date: date.month)\n",
    "data['year'] = data['date'].apply(lambda date: date.year)\n",
    "data['day'] = data['date'].apply(lambda date: date.day)\n",
    "\n",
    "# gets all value from the month 1 and assign to janyary_winds\n",
    "january_winds = data.query('month == 1')\n",
    "\n",
    "# gets the mean from january_winds, using .loc to not print the mean of month, year and day\n",
    "january_winds.loc[:,'RPT':\"MAL\"].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤12  对于数据记录按照年为频率取样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RPT</th>\n",
       "      <th>VAL</th>\n",
       "      <th>ROS</th>\n",
       "      <th>KIL</th>\n",
       "      <th>SHA</th>\n",
       "      <th>BIR</th>\n",
       "      <th>DUB</th>\n",
       "      <th>CLA</th>\n",
       "      <th>MUL</th>\n",
       "      <th>CLO</th>\n",
       "      <th>BEL</th>\n",
       "      <th>MAL</th>\n",
       "      <th>date</th>\n",
       "      <th>month</th>\n",
       "      <th>year</th>\n",
       "      <th>day</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>15.04</td>\n",
       "      <td>14.96</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.87</td>\n",
       "      <td>13.67</td>\n",
       "      <td>10.25</td>\n",
       "      <td>10.83</td>\n",
       "      <td>12.58</td>\n",
       "      <td>18.50</td>\n",
       "      <td>15.04</td>\n",
       "      <td>1961-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1962-01-01</th>\n",
       "      <td>9.29</td>\n",
       "      <td>3.42</td>\n",
       "      <td>11.54</td>\n",
       "      <td>3.50</td>\n",
       "      <td>2.21</td>\n",
       "      <td>1.96</td>\n",
       "      <td>10.41</td>\n",
       "      <td>2.79</td>\n",
       "      <td>3.54</td>\n",
       "      <td>5.17</td>\n",
       "      <td>4.38</td>\n",
       "      <td>7.92</td>\n",
       "      <td>1962-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1962</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1963-01-01</th>\n",
       "      <td>15.59</td>\n",
       "      <td>13.62</td>\n",
       "      <td>19.79</td>\n",
       "      <td>8.38</td>\n",
       "      <td>12.25</td>\n",
       "      <td>10.00</td>\n",
       "      <td>23.45</td>\n",
       "      <td>15.71</td>\n",
       "      <td>13.59</td>\n",
       "      <td>14.37</td>\n",
       "      <td>17.58</td>\n",
       "      <td>34.13</td>\n",
       "      <td>1963-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1963</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1964-01-01</th>\n",
       "      <td>25.80</td>\n",
       "      <td>22.13</td>\n",
       "      <td>18.21</td>\n",
       "      <td>13.25</td>\n",
       "      <td>21.29</td>\n",
       "      <td>14.79</td>\n",
       "      <td>14.12</td>\n",
       "      <td>19.58</td>\n",
       "      <td>13.25</td>\n",
       "      <td>16.75</td>\n",
       "      <td>28.96</td>\n",
       "      <td>21.00</td>\n",
       "      <td>1964-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1964</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1965-01-01</th>\n",
       "      <td>9.54</td>\n",
       "      <td>11.92</td>\n",
       "      <td>9.00</td>\n",
       "      <td>4.38</td>\n",
       "      <td>6.08</td>\n",
       "      <td>5.21</td>\n",
       "      <td>10.25</td>\n",
       "      <td>6.08</td>\n",
       "      <td>5.71</td>\n",
       "      <td>8.63</td>\n",
       "      <td>12.04</td>\n",
       "      <td>17.41</td>\n",
       "      <td>1965-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1965</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1966-01-01</th>\n",
       "      <td>22.04</td>\n",
       "      <td>21.50</td>\n",
       "      <td>17.08</td>\n",
       "      <td>12.75</td>\n",
       "      <td>22.17</td>\n",
       "      <td>15.59</td>\n",
       "      <td>21.79</td>\n",
       "      <td>18.12</td>\n",
       "      <td>16.66</td>\n",
       "      <td>17.83</td>\n",
       "      <td>28.33</td>\n",
       "      <td>23.79</td>\n",
       "      <td>1966-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1966</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1967-01-01</th>\n",
       "      <td>6.46</td>\n",
       "      <td>4.46</td>\n",
       "      <td>6.50</td>\n",
       "      <td>3.21</td>\n",
       "      <td>6.67</td>\n",
       "      <td>3.79</td>\n",
       "      <td>11.38</td>\n",
       "      <td>3.83</td>\n",
       "      <td>7.71</td>\n",
       "      <td>9.08</td>\n",
       "      <td>10.67</td>\n",
       "      <td>20.91</td>\n",
       "      <td>1967-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1967</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1968-01-01</th>\n",
       "      <td>30.04</td>\n",
       "      <td>17.88</td>\n",
       "      <td>16.25</td>\n",
       "      <td>16.25</td>\n",
       "      <td>21.79</td>\n",
       "      <td>12.54</td>\n",
       "      <td>18.16</td>\n",
       "      <td>16.62</td>\n",
       "      <td>18.75</td>\n",
       "      <td>17.62</td>\n",
       "      <td>22.25</td>\n",
       "      <td>27.29</td>\n",
       "      <td>1968-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1968</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1969-01-01</th>\n",
       "      <td>6.13</td>\n",
       "      <td>1.63</td>\n",
       "      <td>5.41</td>\n",
       "      <td>1.08</td>\n",
       "      <td>2.54</td>\n",
       "      <td>1.00</td>\n",
       "      <td>8.50</td>\n",
       "      <td>2.42</td>\n",
       "      <td>4.58</td>\n",
       "      <td>6.34</td>\n",
       "      <td>9.17</td>\n",
       "      <td>16.71</td>\n",
       "      <td>1969-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1969</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1970-01-01</th>\n",
       "      <td>9.59</td>\n",
       "      <td>2.96</td>\n",
       "      <td>11.79</td>\n",
       "      <td>3.42</td>\n",
       "      <td>6.13</td>\n",
       "      <td>4.08</td>\n",
       "      <td>9.00</td>\n",
       "      <td>4.46</td>\n",
       "      <td>7.29</td>\n",
       "      <td>3.50</td>\n",
       "      <td>7.33</td>\n",
       "      <td>13.00</td>\n",
       "      <td>1970-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1970</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1971-01-01</th>\n",
       "      <td>3.71</td>\n",
       "      <td>0.79</td>\n",
       "      <td>4.71</td>\n",
       "      <td>0.17</td>\n",
       "      <td>1.42</td>\n",
       "      <td>1.04</td>\n",
       "      <td>4.63</td>\n",
       "      <td>0.75</td>\n",
       "      <td>1.54</td>\n",
       "      <td>1.08</td>\n",
       "      <td>4.21</td>\n",
       "      <td>9.54</td>\n",
       "      <td>1971-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1971</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1972-01-01</th>\n",
       "      <td>9.29</td>\n",
       "      <td>3.63</td>\n",
       "      <td>14.54</td>\n",
       "      <td>4.25</td>\n",
       "      <td>6.75</td>\n",
       "      <td>4.42</td>\n",
       "      <td>13.00</td>\n",
       "      <td>5.33</td>\n",
       "      <td>10.04</td>\n",
       "      <td>8.54</td>\n",
       "      <td>8.71</td>\n",
       "      <td>19.17</td>\n",
       "      <td>1972-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1972</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1973-01-01</th>\n",
       "      <td>16.50</td>\n",
       "      <td>15.92</td>\n",
       "      <td>14.62</td>\n",
       "      <td>7.41</td>\n",
       "      <td>8.29</td>\n",
       "      <td>11.21</td>\n",
       "      <td>13.54</td>\n",
       "      <td>7.79</td>\n",
       "      <td>10.46</td>\n",
       "      <td>10.79</td>\n",
       "      <td>13.37</td>\n",
       "      <td>9.71</td>\n",
       "      <td>1973-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1973</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1974-01-01</th>\n",
       "      <td>23.21</td>\n",
       "      <td>16.54</td>\n",
       "      <td>16.08</td>\n",
       "      <td>9.75</td>\n",
       "      <td>15.83</td>\n",
       "      <td>11.46</td>\n",
       "      <td>9.54</td>\n",
       "      <td>13.54</td>\n",
       "      <td>13.83</td>\n",
       "      <td>16.66</td>\n",
       "      <td>17.21</td>\n",
       "      <td>25.29</td>\n",
       "      <td>1974-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1974</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1975-01-01</th>\n",
       "      <td>14.04</td>\n",
       "      <td>13.54</td>\n",
       "      <td>11.29</td>\n",
       "      <td>5.46</td>\n",
       "      <td>12.58</td>\n",
       "      <td>5.58</td>\n",
       "      <td>8.12</td>\n",
       "      <td>8.96</td>\n",
       "      <td>9.29</td>\n",
       "      <td>5.17</td>\n",
       "      <td>7.71</td>\n",
       "      <td>11.63</td>\n",
       "      <td>1975-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1975</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1976-01-01</th>\n",
       "      <td>18.34</td>\n",
       "      <td>17.67</td>\n",
       "      <td>14.83</td>\n",
       "      <td>8.00</td>\n",
       "      <td>16.62</td>\n",
       "      <td>10.13</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.04</td>\n",
       "      <td>13.13</td>\n",
       "      <td>5.75</td>\n",
       "      <td>11.38</td>\n",
       "      <td>14.96</td>\n",
       "      <td>1976-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1976</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1977-01-01</th>\n",
       "      <td>20.04</td>\n",
       "      <td>11.92</td>\n",
       "      <td>20.25</td>\n",
       "      <td>9.13</td>\n",
       "      <td>9.29</td>\n",
       "      <td>8.04</td>\n",
       "      <td>10.75</td>\n",
       "      <td>5.88</td>\n",
       "      <td>9.00</td>\n",
       "      <td>9.00</td>\n",
       "      <td>14.88</td>\n",
       "      <td>25.70</td>\n",
       "      <td>1977-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1977</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-01-01</th>\n",
       "      <td>8.33</td>\n",
       "      <td>7.12</td>\n",
       "      <td>7.71</td>\n",
       "      <td>3.54</td>\n",
       "      <td>8.50</td>\n",
       "      <td>7.50</td>\n",
       "      <td>14.71</td>\n",
       "      <td>10.00</td>\n",
       "      <td>11.83</td>\n",
       "      <td>10.00</td>\n",
       "      <td>15.09</td>\n",
       "      <td>20.46</td>\n",
       "      <td>1978-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              RPT    VAL    ROS    KIL    SHA    BIR    DUB    CLA    MUL  \\\n",
       "Yr_Mo_Dy                                                                    \n",
       "1961-01-01  15.04  14.96  13.17   9.29    NaN   9.87  13.67  10.25  10.83   \n",
       "1962-01-01   9.29   3.42  11.54   3.50   2.21   1.96  10.41   2.79   3.54   \n",
       "1963-01-01  15.59  13.62  19.79   8.38  12.25  10.00  23.45  15.71  13.59   \n",
       "1964-01-01  25.80  22.13  18.21  13.25  21.29  14.79  14.12  19.58  13.25   \n",
       "1965-01-01   9.54  11.92   9.00   4.38   6.08   5.21  10.25   6.08   5.71   \n",
       "1966-01-01  22.04  21.50  17.08  12.75  22.17  15.59  21.79  18.12  16.66   \n",
       "1967-01-01   6.46   4.46   6.50   3.21   6.67   3.79  11.38   3.83   7.71   \n",
       "1968-01-01  30.04  17.88  16.25  16.25  21.79  12.54  18.16  16.62  18.75   \n",
       "1969-01-01   6.13   1.63   5.41   1.08   2.54   1.00   8.50   2.42   4.58   \n",
       "1970-01-01   9.59   2.96  11.79   3.42   6.13   4.08   9.00   4.46   7.29   \n",
       "1971-01-01   3.71   0.79   4.71   0.17   1.42   1.04   4.63   0.75   1.54   \n",
       "1972-01-01   9.29   3.63  14.54   4.25   6.75   4.42  13.00   5.33  10.04   \n",
       "1973-01-01  16.50  15.92  14.62   7.41   8.29  11.21  13.54   7.79  10.46   \n",
       "1974-01-01  23.21  16.54  16.08   9.75  15.83  11.46   9.54  13.54  13.83   \n",
       "1975-01-01  14.04  13.54  11.29   5.46  12.58   5.58   8.12   8.96   9.29   \n",
       "1976-01-01  18.34  17.67  14.83   8.00  16.62  10.13  13.17   9.04  13.13   \n",
       "1977-01-01  20.04  11.92  20.25   9.13   9.29   8.04  10.75   5.88   9.00   \n",
       "1978-01-01   8.33   7.12   7.71   3.54   8.50   7.50  14.71  10.00  11.83   \n",
       "\n",
       "              CLO    BEL    MAL       date  month  year  day  \n",
       "Yr_Mo_Dy                                                      \n",
       "1961-01-01  12.58  18.50  15.04 1961-01-01      1  1961    1  \n",
       "1962-01-01   5.17   4.38   7.92 1962-01-01      1  1962    1  \n",
       "1963-01-01  14.37  17.58  34.13 1963-01-01      1  1963    1  \n",
       "1964-01-01  16.75  28.96  21.00 1964-01-01      1  1964    1  \n",
       "1965-01-01   8.63  12.04  17.41 1965-01-01      1  1965    1  \n",
       "1966-01-01  17.83  28.33  23.79 1966-01-01      1  1966    1  \n",
       "1967-01-01   9.08  10.67  20.91 1967-01-01      1  1967    1  \n",
       "1968-01-01  17.62  22.25  27.29 1968-01-01      1  1968    1  \n",
       "1969-01-01   6.34   9.17  16.71 1969-01-01      1  1969    1  \n",
       "1970-01-01   3.50   7.33  13.00 1970-01-01      1  1970    1  \n",
       "1971-01-01   1.08   4.21   9.54 1971-01-01      1  1971    1  \n",
       "1972-01-01   8.54   8.71  19.17 1972-01-01      1  1972    1  \n",
       "1973-01-01  10.79  13.37   9.71 1973-01-01      1  1973    1  \n",
       "1974-01-01  16.66  17.21  25.29 1974-01-01      1  1974    1  \n",
       "1975-01-01   5.17   7.71  11.63 1975-01-01      1  1975    1  \n",
       "1976-01-01   5.75  11.38  14.96 1976-01-01      1  1976    1  \n",
       "1977-01-01   9.00  14.88  25.70 1977-01-01      1  1977    1  \n",
       "1978-01-01  10.00  15.09  20.46 1978-01-01      1  1978    1  "
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data.query('month == 1 and day == 1')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤13 对于数据记录按照月为频率取样"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>RPT</th>\n",
       "      <th>VAL</th>\n",
       "      <th>ROS</th>\n",
       "      <th>KIL</th>\n",
       "      <th>SHA</th>\n",
       "      <th>BIR</th>\n",
       "      <th>DUB</th>\n",
       "      <th>CLA</th>\n",
       "      <th>MUL</th>\n",
       "      <th>CLO</th>\n",
       "      <th>BEL</th>\n",
       "      <th>MAL</th>\n",
       "      <th>date</th>\n",
       "      <th>month</th>\n",
       "      <th>year</th>\n",
       "      <th>day</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yr_Mo_Dy</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1961-01-01</th>\n",
       "      <td>15.04</td>\n",
       "      <td>14.96</td>\n",
       "      <td>13.17</td>\n",
       "      <td>9.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>9.87</td>\n",
       "      <td>13.67</td>\n",
       "      <td>10.25</td>\n",
       "      <td>10.83</td>\n",
       "      <td>12.58</td>\n",
       "      <td>18.50</td>\n",
       "      <td>15.04</td>\n",
       "      <td>1961-01-01</td>\n",
       "      <td>1</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-02-01</th>\n",
       "      <td>14.25</td>\n",
       "      <td>15.12</td>\n",
       "      <td>9.04</td>\n",
       "      <td>5.88</td>\n",
       "      <td>12.08</td>\n",
       "      <td>7.17</td>\n",
       "      <td>10.17</td>\n",
       "      <td>3.63</td>\n",
       "      <td>6.50</td>\n",
       "      <td>5.50</td>\n",
       "      <td>9.17</td>\n",
       "      <td>8.00</td>\n",
       "      <td>1961-02-01</td>\n",
       "      <td>2</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-03-01</th>\n",
       "      <td>12.67</td>\n",
       "      <td>13.13</td>\n",
       "      <td>11.79</td>\n",
       "      <td>6.42</td>\n",
       "      <td>9.79</td>\n",
       "      <td>8.54</td>\n",
       "      <td>10.25</td>\n",
       "      <td>13.29</td>\n",
       "      <td>NaN</td>\n",
       "      <td>12.21</td>\n",
       "      <td>20.62</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1961-03-01</td>\n",
       "      <td>3</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-04-01</th>\n",
       "      <td>8.38</td>\n",
       "      <td>6.34</td>\n",
       "      <td>8.33</td>\n",
       "      <td>6.75</td>\n",
       "      <td>9.33</td>\n",
       "      <td>9.54</td>\n",
       "      <td>11.67</td>\n",
       "      <td>8.21</td>\n",
       "      <td>11.21</td>\n",
       "      <td>6.46</td>\n",
       "      <td>11.96</td>\n",
       "      <td>7.17</td>\n",
       "      <td>1961-04-01</td>\n",
       "      <td>4</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1961-05-01</th>\n",
       "      <td>15.87</td>\n",
       "      <td>13.88</td>\n",
       "      <td>15.37</td>\n",
       "      <td>9.79</td>\n",
       "      <td>13.46</td>\n",
       "      <td>10.17</td>\n",
       "      <td>9.96</td>\n",
       "      <td>14.04</td>\n",
       "      <td>9.75</td>\n",
       "      <td>9.92</td>\n",
       "      <td>18.63</td>\n",
       "      <td>11.12</td>\n",
       "      <td>1961-05-01</td>\n",
       "      <td>5</td>\n",
       "      <td>1961</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-08-01</th>\n",
       "      <td>19.33</td>\n",
       "      <td>15.09</td>\n",
       "      <td>20.17</td>\n",
       "      <td>8.83</td>\n",
       "      <td>12.62</td>\n",
       "      <td>10.41</td>\n",
       "      <td>9.33</td>\n",
       "      <td>12.33</td>\n",
       "      <td>9.50</td>\n",
       "      <td>9.92</td>\n",
       "      <td>15.75</td>\n",
       "      <td>18.00</td>\n",
       "      <td>1978-08-01</td>\n",
       "      <td>8</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-09-01</th>\n",
       "      <td>8.42</td>\n",
       "      <td>6.13</td>\n",
       "      <td>9.87</td>\n",
       "      <td>5.25</td>\n",
       "      <td>3.21</td>\n",
       "      <td>5.71</td>\n",
       "      <td>7.25</td>\n",
       "      <td>3.50</td>\n",
       "      <td>7.33</td>\n",
       "      <td>6.50</td>\n",
       "      <td>7.62</td>\n",
       "      <td>15.96</td>\n",
       "      <td>1978-09-01</td>\n",
       "      <td>9</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-10-01</th>\n",
       "      <td>9.50</td>\n",
       "      <td>6.83</td>\n",
       "      <td>10.50</td>\n",
       "      <td>3.88</td>\n",
       "      <td>6.13</td>\n",
       "      <td>4.58</td>\n",
       "      <td>4.21</td>\n",
       "      <td>6.50</td>\n",
       "      <td>6.38</td>\n",
       "      <td>6.54</td>\n",
       "      <td>10.63</td>\n",
       "      <td>14.09</td>\n",
       "      <td>1978-10-01</td>\n",
       "      <td>10</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-11-01</th>\n",
       "      <td>13.59</td>\n",
       "      <td>16.75</td>\n",
       "      <td>11.25</td>\n",
       "      <td>7.08</td>\n",
       "      <td>11.04</td>\n",
       "      <td>8.33</td>\n",
       "      <td>8.17</td>\n",
       "      <td>11.29</td>\n",
       "      <td>10.75</td>\n",
       "      <td>11.25</td>\n",
       "      <td>23.13</td>\n",
       "      <td>25.00</td>\n",
       "      <td>1978-11-01</td>\n",
       "      <td>11</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1978-12-01</th>\n",
       "      <td>21.29</td>\n",
       "      <td>16.29</td>\n",
       "      <td>24.04</td>\n",
       "      <td>12.79</td>\n",
       "      <td>18.21</td>\n",
       "      <td>19.29</td>\n",
       "      <td>21.54</td>\n",
       "      <td>17.21</td>\n",
       "      <td>16.71</td>\n",
       "      <td>17.83</td>\n",
       "      <td>17.75</td>\n",
       "      <td>25.70</td>\n",
       "      <td>1978-12-01</td>\n",
       "      <td>12</td>\n",
       "      <td>1978</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>216 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              RPT    VAL    ROS    KIL    SHA    BIR    DUB    CLA    MUL  \\\n",
       "Yr_Mo_Dy                                                                    \n",
       "1961-01-01  15.04  14.96  13.17   9.29    NaN   9.87  13.67  10.25  10.83   \n",
       "1961-02-01  14.25  15.12   9.04   5.88  12.08   7.17  10.17   3.63   6.50   \n",
       "1961-03-01  12.67  13.13  11.79   6.42   9.79   8.54  10.25  13.29    NaN   \n",
       "1961-04-01   8.38   6.34   8.33   6.75   9.33   9.54  11.67   8.21  11.21   \n",
       "1961-05-01  15.87  13.88  15.37   9.79  13.46  10.17   9.96  14.04   9.75   \n",
       "...           ...    ...    ...    ...    ...    ...    ...    ...    ...   \n",
       "1978-08-01  19.33  15.09  20.17   8.83  12.62  10.41   9.33  12.33   9.50   \n",
       "1978-09-01   8.42   6.13   9.87   5.25   3.21   5.71   7.25   3.50   7.33   \n",
       "1978-10-01   9.50   6.83  10.50   3.88   6.13   4.58   4.21   6.50   6.38   \n",
       "1978-11-01  13.59  16.75  11.25   7.08  11.04   8.33   8.17  11.29  10.75   \n",
       "1978-12-01  21.29  16.29  24.04  12.79  18.21  19.29  21.54  17.21  16.71   \n",
       "\n",
       "              CLO    BEL    MAL       date  month  year  day  \n",
       "Yr_Mo_Dy                                                      \n",
       "1961-01-01  12.58  18.50  15.04 1961-01-01      1  1961    1  \n",
       "1961-02-01   5.50   9.17   8.00 1961-02-01      2  1961    1  \n",
       "1961-03-01  12.21  20.62    NaN 1961-03-01      3  1961    1  \n",
       "1961-04-01   6.46  11.96   7.17 1961-04-01      4  1961    1  \n",
       "1961-05-01   9.92  18.63  11.12 1961-05-01      5  1961    1  \n",
       "...           ...    ...    ...        ...    ...   ...  ...  \n",
       "1978-08-01   9.92  15.75  18.00 1978-08-01      8  1978    1  \n",
       "1978-09-01   6.50   7.62  15.96 1978-09-01      9  1978    1  \n",
       "1978-10-01   6.54  10.63  14.09 1978-10-01     10  1978    1  \n",
       "1978-11-01  11.25  23.13  25.00 1978-11-01     11  1978    1  \n",
       "1978-12-01  17.83  17.75  25.70 1978-12-01     12  1978    1  \n",
       "\n",
       "[216 rows x 16 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "data.query('day == 1')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习7-可视化\n",
    "## 探索泰坦尼克灾难数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import numpy as np\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 从以下地址导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path7 = 'exercise_data/train.csv'  # train.csv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据框命名为titanic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>PassengerId</th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   PassengerId  Survived  Pclass  \\\n",
       "0            1         0       3   \n",
       "1            2         1       1   \n",
       "2            3         1       3   \n",
       "3            4         1       1   \n",
       "4            5         0       3   \n",
       "\n",
       "                                                Name     Sex   Age  SibSp  \\\n",
       "0                            Braund, Mr. Owen Harris    male  22.0      1   \n",
       "1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   \n",
       "2                             Heikkinen, Miss. Laina  female  26.0      0   \n",
       "3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   \n",
       "4                           Allen, Mr. William Henry    male  35.0      0   \n",
       "\n",
       "   Parch            Ticket     Fare Cabin Embarked  \n",
       "0      0         A/5 21171   7.2500   NaN        S  \n",
       "1      0          PC 17599  71.2833   C85        C  \n",
       "2      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "3      0            113803  53.1000  C123        S  \n",
       "4      0            373450   8.0500   NaN        S  "
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "titanic = pd.read_csv(path7)\n",
    "titanic.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 将PassengerId设置为索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Survived</th>\n",
       "      <th>Pclass</th>\n",
       "      <th>Name</th>\n",
       "      <th>Sex</th>\n",
       "      <th>Age</th>\n",
       "      <th>SibSp</th>\n",
       "      <th>Parch</th>\n",
       "      <th>Ticket</th>\n",
       "      <th>Fare</th>\n",
       "      <th>Cabin</th>\n",
       "      <th>Embarked</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PassengerId</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Braund, Mr. Owen Harris</td>\n",
       "      <td>male</td>\n",
       "      <td>22.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>A/5 21171</td>\n",
       "      <td>7.2500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>\n",
       "      <td>female</td>\n",
       "      <td>38.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>PC 17599</td>\n",
       "      <td>71.2833</td>\n",
       "      <td>C85</td>\n",
       "      <td>C</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>Heikkinen, Miss. Laina</td>\n",
       "      <td>female</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>STON/O2. 3101282</td>\n",
       "      <td>7.9250</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>\n",
       "      <td>female</td>\n",
       "      <td>35.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>113803</td>\n",
       "      <td>53.1000</td>\n",
       "      <td>C123</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>Allen, Mr. William Henry</td>\n",
       "      <td>male</td>\n",
       "      <td>35.0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>373450</td>\n",
       "      <td>8.0500</td>\n",
       "      <td>NaN</td>\n",
       "      <td>S</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Survived  Pclass  \\\n",
       "PassengerId                     \n",
       "1                   0       3   \n",
       "2                   1       1   \n",
       "3                   1       3   \n",
       "4                   1       1   \n",
       "5                   0       3   \n",
       "\n",
       "                                                          Name     Sex   Age  \\\n",
       "PassengerId                                                                    \n",
       "1                                      Braund, Mr. Owen Harris    male  22.0   \n",
       "2            Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0   \n",
       "3                                       Heikkinen, Miss. Laina  female  26.0   \n",
       "4                 Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0   \n",
       "5                                     Allen, Mr. William Henry    male  35.0   \n",
       "\n",
       "             SibSp  Parch            Ticket     Fare Cabin Embarked  \n",
       "PassengerId                                                          \n",
       "1                1      0         A/5 21171   7.2500   NaN        S  \n",
       "2                1      0          PC 17599  71.2833   C85        C  \n",
       "3                0      0  STON/O2. 3101282   7.9250   NaN        S  \n",
       "4                1      0            113803  53.1000  C123        S  \n",
       "5                0      0            373450   8.0500   NaN        S  "
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "titanic.set_index('PassengerId').head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 绘制一个展示男女乘客比例的扇形图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAagAAAEYCAYAAAAJeGK1AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAHp9JREFUeJzt3XvcpWO9x/HP18yQ45CcGXIYhxkMSipCQkR2Ozo5NHJo2xu7slOhk+gk5bR78Qohh3RgUxGVKIeYhMFQYVJOIWczZsbMb/9x3WPWPPOcn7XWdd1rfd+v13rNetbp/j6veeb5znXd133figjMzMxKs1juAGZmZr1xQZmZWZFcUGZmViQXlJmZFckFZWZmRXJBmZlZkVxQZjUl6SVJ6+bOYdYqLigrnqRtJd0s6XlJz0i6SdKbW7CdkPRy9Yv/UUnfljSq2dsZDknXSzq48bGIWCYiHsqVyazVRucOYNYfScsBPwcOA34ELA5sB8xq0SY3j4gHJG0EXA/8BTizR6bREfFqi7a/EEkC1I5tmZXGIygr3XiAiLgkIuZGxMyIuDYips5/gaSPSbpP0rOSrpG0dvX42yQ9LWmt6uvNq9dsNNBGI+J+4PfAxOq9f5P0GUlTgZcljZa0cTWyeU7SvZLe25DpPElnSvqVpBcl3TA/V0O2KdWocIqktzU8d72kEyXdBMwAfkAq5TOq0d0Z1etC0vrV/bGSLpD0lKSHJR0nabHqucmSbpT0rer7ny5pt2H+fZi1jQvKSvcXYK6k8yXtJmmFxicl7QUcA/w7s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JBeUmZkVyQVlZmZFckGZmVmRXFBmZlYkF5SZmRXJBWVmZkVyQZmZWZFcUGZmViQXlJmZFckFZWZmRXJBmZlZkVxQZmZWJBeUmZkVyQVlZmZFckGZmVmR/h+r3qFKsza+KgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# sum the instances of males and females\n",
    "males = (titanic['Sex'] == 'male').sum()\n",
    "females = (titanic['Sex'] == 'female').sum()\n",
    "\n",
    "# put them into a list called proportions\n",
    "proportions = [males, females]\n",
    "\n",
    "# Create a pie chart\n",
    "plt.pie(\n",
    "    # using proportions\n",
    "    proportions,\n",
    "    \n",
    "    # with the labels being officer names\n",
    "    labels = ['Males', 'Females'],\n",
    "    \n",
    "    # with no shadows\n",
    "    shadow = False,\n",
    "    \n",
    "    # with colors\n",
    "    colors = ['blue','red'],\n",
    "    \n",
    "    # with one slide exploded out\n",
    "    explode = (0.15 , 0),\n",
    "    \n",
    "    # with the start angle at 90%\n",
    "    startangle = 90,\n",
    "    \n",
    "    # with the percent listed as a fraction\n",
    "    autopct = '%1.1f%%'\n",
    "    )\n",
    "\n",
    "# View the plot drop above\n",
    "plt.axis('equal')\n",
    "\n",
    "# Set labels\n",
    "plt.title(\"Sex Proportion\")\n",
    "\n",
    "# View the plot\n",
    "plt.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 绘制一个展示船票```Fare```, 与乘客年龄和性别的散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(-5, 85)"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAaMAAAFtCAYAAAC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      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# creates the plot using\n",
    "lm = sns.lmplot(x = 'Age', y = 'Fare', data = titanic, hue = 'Sex', fit_reg=False)\n",
    "\n",
    "# set title\n",
    "lm.set(title = 'Fare x Age')\n",
    "\n",
    "# get the axes object and tweak it\n",
    "axes = lm.axes\n",
    "axes[0,0].set_ylim(-5,)\n",
    "axes[0,0].set_xlim(-5,85)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 有多少人生还？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "342"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "titanic.Survived.sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 绘制一个展示船票价格的直方图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEWCAYAAAB8LwAVAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAGzNJREFUeJzt3X+4HmV95/H3B0IFhfJDIkYCBjVqaauRphSrdi1Wi1gLtlRlrVKLpb3Ea7Frf4C1VfeSXdxtpdpVLqNSgxWVgj8oWisiW0t3BYJGfkqJEktCIBH5IWhR4nf/mPvAQ5ic85wkz3nOyXm/rmuuM3PPPTPf+8mT8z1zzz0zqSokSdrSLuMOQJI0O5kgJEm9TBCSpF4mCElSLxOEJKmXCUKS1MsEI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CElSr1n1RjlpLkiymW7Y4IRjq2rtmMKRRsZhrtI0Jbm3qvbchu0W1EPPM5JmPbuYpB0gyZIk/5Lkq236xVb+/FZ+Id1dryT57XTvj1id5P3tEfTSrGOCkKZvj/bLfXWST7WyjcALq3so3CuA9wzUPww4paqemuSn2vrnVPdwv83Aq2YyeGlYXoOQpu8H7Zf7oN2A/51k4pf+UwfWXVFVN7f5FwA/B1zZPZKKPXjo4WrSrGKCkHaMPwRup3vL1y7Afwysu29gPsDKqjptBmOTtoldTNKOsTewoap+DLwa2Np1hUuA45I8Dh58N/ITZyhGaVpMENKO8T7ghCRfp3tZ0H19larqeuAtdG84u5ru7XOLZixKaRoc5ipJ6uUZhCSplwlCktTLBCFJ6mWCkCT1MkFIknqZICRJvUwQkqRe/x94AVUTjap+nQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# sort the values from the top to the least value and slice the first 5 items\n",
    "df = titanic.Fare.sort_values(ascending = False)\n",
    "df\n",
    "\n",
    "# create bins interval using numpy\n",
    "binsVal = np.arange(0,600,10)\n",
    "binsVal\n",
    "\n",
    "# create the plot\n",
    "plt.hist(df, bins = binsVal)\n",
    "\n",
    "# Set the title and labels\n",
    "plt.xlabel('Fare')\n",
    "plt.ylabel('Frequency')\n",
    "plt.title('Fare Payed Histrogram')\n",
    "\n",
    "# show the plot\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习8-创建数据框\n",
    "## Pokemon 数据\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 创建一个数据字典"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "raw_data = {\"name\": ['Bulbasaur', 'Charmander','Squirtle','Caterpie'],\n",
    "            \"evolution\": ['Ivysaur','Charmeleon','Wartortle','Metapod'],\n",
    "            \"type\": ['grass', 'fire', 'water', 'bug'],\n",
    "            \"hp\": [45, 39, 44, 45],\n",
    "            \"pokedex\": ['yes', 'no','yes','no']                        \n",
    "            }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据字典存为一个名叫pokemon的数据框中"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>evolution</th>\n",
       "      <th>type</th>\n",
       "      <th>hp</th>\n",
       "      <th>pokedex</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Bulbasaur</td>\n",
       "      <td>Ivysaur</td>\n",
       "      <td>grass</td>\n",
       "      <td>45</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Charmander</td>\n",
       "      <td>Charmeleon</td>\n",
       "      <td>fire</td>\n",
       "      <td>39</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Squirtle</td>\n",
       "      <td>Wartortle</td>\n",
       "      <td>water</td>\n",
       "      <td>44</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Caterpie</td>\n",
       "      <td>Metapod</td>\n",
       "      <td>bug</td>\n",
       "      <td>45</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         name   evolution   type  hp pokedex\n",
       "0   Bulbasaur     Ivysaur  grass  45     yes\n",
       "1  Charmander  Charmeleon   fire  39      no\n",
       "2    Squirtle   Wartortle  water  44     yes\n",
       "3    Caterpie     Metapod    bug  45      no"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pokemon = pd.DataFrame(raw_data)\n",
    "pokemon.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 数据框的列排序是字母顺序，请重新修改为```name, type, hp, evolution, pokedex```这个顺序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>type</th>\n",
       "      <th>hp</th>\n",
       "      <th>evolution</th>\n",
       "      <th>pokedex</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Bulbasaur</td>\n",
       "      <td>grass</td>\n",
       "      <td>45</td>\n",
       "      <td>Ivysaur</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Charmander</td>\n",
       "      <td>fire</td>\n",
       "      <td>39</td>\n",
       "      <td>Charmeleon</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Squirtle</td>\n",
       "      <td>water</td>\n",
       "      <td>44</td>\n",
       "      <td>Wartortle</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Caterpie</td>\n",
       "      <td>bug</td>\n",
       "      <td>45</td>\n",
       "      <td>Metapod</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         name   type  hp   evolution pokedex\n",
       "0   Bulbasaur  grass  45     Ivysaur     yes\n",
       "1  Charmander   fire  39  Charmeleon      no\n",
       "2    Squirtle  water  44   Wartortle     yes\n",
       "3    Caterpie    bug  45     Metapod      no"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pokemon = pokemon[['name', 'type', 'hp', 'evolution','pokedex']]\n",
    "pokemon"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 添加一个列```place```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>type</th>\n",
       "      <th>hp</th>\n",
       "      <th>evolution</th>\n",
       "      <th>pokedex</th>\n",
       "      <th>place</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Bulbasaur</td>\n",
       "      <td>grass</td>\n",
       "      <td>45</td>\n",
       "      <td>Ivysaur</td>\n",
       "      <td>yes</td>\n",
       "      <td>park</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Charmander</td>\n",
       "      <td>fire</td>\n",
       "      <td>39</td>\n",
       "      <td>Charmeleon</td>\n",
       "      <td>no</td>\n",
       "      <td>street</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Squirtle</td>\n",
       "      <td>water</td>\n",
       "      <td>44</td>\n",
       "      <td>Wartortle</td>\n",
       "      <td>yes</td>\n",
       "      <td>lake</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Caterpie</td>\n",
       "      <td>bug</td>\n",
       "      <td>45</td>\n",
       "      <td>Metapod</td>\n",
       "      <td>no</td>\n",
       "      <td>forest</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         name   type  hp   evolution pokedex   place\n",
       "0   Bulbasaur  grass  45     Ivysaur     yes    park\n",
       "1  Charmander   fire  39  Charmeleon      no  street\n",
       "2    Squirtle  water  44   Wartortle     yes    lake\n",
       "3    Caterpie    bug  45     Metapod      no  forest"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pokemon['place'] = ['park','street','lake','forest']\n",
    "pokemon"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 查看每个列的数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "name         object\n",
       "type         object\n",
       "hp            int64\n",
       "evolution    object\n",
       "pokedex      object\n",
       "place        object\n",
       "dtype: object"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pokemon.dtypes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习9-时间序列\n",
    "## Apple公司股价数据\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "\n",
    "# visualization\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 数据集地址"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path9 = 'exercise_data/Apple_stock.csv'   # Apple_stock.csv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 读取数据并存为一个名叫apple的数据框"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date</th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Adj Close</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2014-07-08</td>\n",
       "      <td>96.27</td>\n",
       "      <td>96.80</td>\n",
       "      <td>93.92</td>\n",
       "      <td>95.35</td>\n",
       "      <td>65130000</td>\n",
       "      <td>95.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2014-07-07</td>\n",
       "      <td>94.14</td>\n",
       "      <td>95.99</td>\n",
       "      <td>94.10</td>\n",
       "      <td>95.97</td>\n",
       "      <td>56305400</td>\n",
       "      <td>95.97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2014-07-03</td>\n",
       "      <td>93.67</td>\n",
       "      <td>94.10</td>\n",
       "      <td>93.20</td>\n",
       "      <td>94.03</td>\n",
       "      <td>22891800</td>\n",
       "      <td>94.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2014-07-02</td>\n",
       "      <td>93.87</td>\n",
       "      <td>94.06</td>\n",
       "      <td>93.09</td>\n",
       "      <td>93.48</td>\n",
       "      <td>28420900</td>\n",
       "      <td>93.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2014-07-01</td>\n",
       "      <td>93.52</td>\n",
       "      <td>94.07</td>\n",
       "      <td>93.13</td>\n",
       "      <td>93.52</td>\n",
       "      <td>38170200</td>\n",
       "      <td>93.52</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         Date   Open   High    Low  Close    Volume  Adj Close\n",
       "0  2014-07-08  96.27  96.80  93.92  95.35  65130000      95.35\n",
       "1  2014-07-07  94.14  95.99  94.10  95.97  56305400      95.97\n",
       "2  2014-07-03  93.67  94.10  93.20  94.03  22891800      94.03\n",
       "3  2014-07-02  93.87  94.06  93.09  93.48  28420900      93.48\n",
       "4  2014-07-01  93.52  94.07  93.13  93.52  38170200      93.52"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple = pd.read_csv(path9)\n",
    "apple.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "\n",
    "### 步骤4 查看每一列的数据类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Date          object\n",
       "Open         float64\n",
       "High         float64\n",
       "Low          float64\n",
       "Close        float64\n",
       "Volume         int64\n",
       "Adj Close    float64\n",
       "dtype: object"
      ]
     },
     "execution_count": 77,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "apple.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Date          object\n",
       "Open         float64\n",
       "High         float64\n",
       "Low          float64\n",
       "Close        float64\n",
       "Volume         int64\n",
       "Adj Close    float64\n",
       "dtype: object"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple.dtypes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 将```Date```这个列转换为```datetime```类型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0   2014-07-08\n",
       "1   2014-07-07\n",
       "2   2014-07-03\n",
       "3   2014-07-02\n",
       "4   2014-07-01\n",
       "Name: Date, dtype: datetime64[ns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple.Date = pd.to_datetime(apple.Date)\n",
    "apple['Date'].head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 将```Date```设置为索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Adj Close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2014-07-08</th>\n",
       "      <td>96.27</td>\n",
       "      <td>96.80</td>\n",
       "      <td>93.92</td>\n",
       "      <td>95.35</td>\n",
       "      <td>65130000</td>\n",
       "      <td>95.35</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-07-07</th>\n",
       "      <td>94.14</td>\n",
       "      <td>95.99</td>\n",
       "      <td>94.10</td>\n",
       "      <td>95.97</td>\n",
       "      <td>56305400</td>\n",
       "      <td>95.97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-07-03</th>\n",
       "      <td>93.67</td>\n",
       "      <td>94.10</td>\n",
       "      <td>93.20</td>\n",
       "      <td>94.03</td>\n",
       "      <td>22891800</td>\n",
       "      <td>94.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-07-02</th>\n",
       "      <td>93.87</td>\n",
       "      <td>94.06</td>\n",
       "      <td>93.09</td>\n",
       "      <td>93.48</td>\n",
       "      <td>28420900</td>\n",
       "      <td>93.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-07-01</th>\n",
       "      <td>93.52</td>\n",
       "      <td>94.07</td>\n",
       "      <td>93.13</td>\n",
       "      <td>93.52</td>\n",
       "      <td>38170200</td>\n",
       "      <td>93.52</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Open   High    Low  Close    Volume  Adj Close\n",
       "Date                                                       \n",
       "2014-07-08  96.27  96.80  93.92  95.35  65130000      95.35\n",
       "2014-07-07  94.14  95.99  94.10  95.97  56305400      95.97\n",
       "2014-07-03  93.67  94.10  93.20  94.03  22891800      94.03\n",
       "2014-07-02  93.87  94.06  93.09  93.48  28420900      93.48\n",
       "2014-07-01  93.52  94.07  93.13  93.52  38170200      93.52"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple = apple.set_index('Date')\n",
    "apple.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 有重复的日期吗？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple.index.is_unique"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 将index设置为升序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Adj Close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1980-12-12</th>\n",
       "      <td>28.75</td>\n",
       "      <td>28.87</td>\n",
       "      <td>28.75</td>\n",
       "      <td>28.75</td>\n",
       "      <td>117258400</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-15</th>\n",
       "      <td>27.38</td>\n",
       "      <td>27.38</td>\n",
       "      <td>27.25</td>\n",
       "      <td>27.25</td>\n",
       "      <td>43971200</td>\n",
       "      <td>0.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-16</th>\n",
       "      <td>25.37</td>\n",
       "      <td>25.37</td>\n",
       "      <td>25.25</td>\n",
       "      <td>25.25</td>\n",
       "      <td>26432000</td>\n",
       "      <td>0.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-17</th>\n",
       "      <td>25.87</td>\n",
       "      <td>26.00</td>\n",
       "      <td>25.87</td>\n",
       "      <td>25.87</td>\n",
       "      <td>21610400</td>\n",
       "      <td>0.40</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-18</th>\n",
       "      <td>26.63</td>\n",
       "      <td>26.75</td>\n",
       "      <td>26.63</td>\n",
       "      <td>26.63</td>\n",
       "      <td>18362400</td>\n",
       "      <td>0.41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-19</th>\n",
       "      <td>28.25</td>\n",
       "      <td>28.38</td>\n",
       "      <td>28.25</td>\n",
       "      <td>28.25</td>\n",
       "      <td>12157600</td>\n",
       "      <td>0.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-22</th>\n",
       "      <td>29.63</td>\n",
       "      <td>29.75</td>\n",
       "      <td>29.63</td>\n",
       "      <td>29.63</td>\n",
       "      <td>9340800</td>\n",
       "      <td>0.46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-23</th>\n",
       "      <td>30.88</td>\n",
       "      <td>31.00</td>\n",
       "      <td>30.88</td>\n",
       "      <td>30.88</td>\n",
       "      <td>11737600</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-24</th>\n",
       "      <td>32.50</td>\n",
       "      <td>32.63</td>\n",
       "      <td>32.50</td>\n",
       "      <td>32.50</td>\n",
       "      <td>12000800</td>\n",
       "      <td>0.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-26</th>\n",
       "      <td>35.50</td>\n",
       "      <td>35.62</td>\n",
       "      <td>35.50</td>\n",
       "      <td>35.50</td>\n",
       "      <td>13893600</td>\n",
       "      <td>0.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-29</th>\n",
       "      <td>36.00</td>\n",
       "      <td>36.13</td>\n",
       "      <td>36.00</td>\n",
       "      <td>36.00</td>\n",
       "      <td>23290400</td>\n",
       "      <td>0.56</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-30</th>\n",
       "      <td>35.25</td>\n",
       "      <td>35.25</td>\n",
       "      <td>35.12</td>\n",
       "      <td>35.12</td>\n",
       "      <td>17220000</td>\n",
       "      <td>0.55</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1980-12-31</th>\n",
       "      <td>34.25</td>\n",
       "      <td>34.25</td>\n",
       "      <td>34.13</td>\n",
       "      <td>34.13</td>\n",
       "      <td>8937600</td>\n",
       "      <td>0.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-02</th>\n",
       "      <td>34.50</td>\n",
       "      <td>34.75</td>\n",
       "      <td>34.50</td>\n",
       "      <td>34.50</td>\n",
       "      <td>5415200</td>\n",
       "      <td>0.54</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-05</th>\n",
       "      <td>33.87</td>\n",
       "      <td>33.87</td>\n",
       "      <td>33.75</td>\n",
       "      <td>33.75</td>\n",
       "      <td>8932000</td>\n",
       "      <td>0.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-06</th>\n",
       "      <td>32.37</td>\n",
       "      <td>32.37</td>\n",
       "      <td>32.25</td>\n",
       "      <td>32.25</td>\n",
       "      <td>11289600</td>\n",
       "      <td>0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-07</th>\n",
       "      <td>31.00</td>\n",
       "      <td>31.00</td>\n",
       "      <td>30.88</td>\n",
       "      <td>30.88</td>\n",
       "      <td>13921600</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-08</th>\n",
       "      <td>30.37</td>\n",
       "      <td>30.37</td>\n",
       "      <td>30.25</td>\n",
       "      <td>30.25</td>\n",
       "      <td>9956800</td>\n",
       "      <td>0.47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-09</th>\n",
       "      <td>31.88</td>\n",
       "      <td>32.00</td>\n",
       "      <td>31.88</td>\n",
       "      <td>31.88</td>\n",
       "      <td>5376000</td>\n",
       "      <td>0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-12</th>\n",
       "      <td>31.88</td>\n",
       "      <td>31.88</td>\n",
       "      <td>31.62</td>\n",
       "      <td>31.62</td>\n",
       "      <td>5924800</td>\n",
       "      <td>0.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-13</th>\n",
       "      <td>30.63</td>\n",
       "      <td>30.63</td>\n",
       "      <td>30.50</td>\n",
       "      <td>30.50</td>\n",
       "      <td>5762400</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-14</th>\n",
       "      <td>30.63</td>\n",
       "      <td>30.75</td>\n",
       "      <td>30.63</td>\n",
       "      <td>30.63</td>\n",
       "      <td>3572800</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-15</th>\n",
       "      <td>31.25</td>\n",
       "      <td>31.50</td>\n",
       "      <td>31.25</td>\n",
       "      <td>31.25</td>\n",
       "      <td>3516800</td>\n",
       "      <td>0.49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-16</th>\n",
       "      <td>31.12</td>\n",
       "      <td>31.12</td>\n",
       "      <td>31.00</td>\n",
       "      <td>31.00</td>\n",
       "      <td>3348800</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-19</th>\n",
       "      <td>32.87</td>\n",
       "      <td>33.00</td>\n",
       "      <td>32.87</td>\n",
       "      <td>32.87</td>\n",
       "      <td>10393600</td>\n",
       "      <td>0.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-20</th>\n",
       "      <td>32.00</td>\n",
       "      <td>32.00</td>\n",
       "      <td>31.88</td>\n",
       "      <td>31.88</td>\n",
       "      <td>7520800</td>\n",
       "      <td>0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-21</th>\n",
       "      <td>32.50</td>\n",
       "      <td>32.75</td>\n",
       "      <td>32.50</td>\n",
       "      <td>32.50</td>\n",
       "      <td>3976000</td>\n",
       "      <td>0.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-22</th>\n",
       "      <td>32.87</td>\n",
       "      <td>33.13</td>\n",
       "      <td>32.87</td>\n",
       "      <td>32.87</td>\n",
       "      <td>8887200</td>\n",
       "      <td>0.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-23</th>\n",
       "      <td>32.87</td>\n",
       "      <td>33.00</td>\n",
       "      <td>32.75</td>\n",
       "      <td>32.75</td>\n",
       "      <td>2805600</td>\n",
       "      <td>0.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-26</th>\n",
       "      <td>32.37</td>\n",
       "      <td>32.37</td>\n",
       "      <td>32.25</td>\n",
       "      <td>32.25</td>\n",
       "      <td>6160000</td>\n",
       "      <td>0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-27</th>\n",
       "      <td>32.25</td>\n",
       "      <td>32.25</td>\n",
       "      <td>32.00</td>\n",
       "      <td>32.00</td>\n",
       "      <td>5924800</td>\n",
       "      <td>0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-28</th>\n",
       "      <td>31.12</td>\n",
       "      <td>31.12</td>\n",
       "      <td>31.00</td>\n",
       "      <td>31.00</td>\n",
       "      <td>7039200</td>\n",
       "      <td>0.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-29</th>\n",
       "      <td>30.00</td>\n",
       "      <td>30.00</td>\n",
       "      <td>29.87</td>\n",
       "      <td>29.87</td>\n",
       "      <td>10976000</td>\n",
       "      <td>0.47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-30</th>\n",
       "      <td>28.50</td>\n",
       "      <td>28.50</td>\n",
       "      <td>28.25</td>\n",
       "      <td>28.25</td>\n",
       "      <td>11547200</td>\n",
       "      <td>0.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-02</th>\n",
       "      <td>26.75</td>\n",
       "      <td>26.75</td>\n",
       "      <td>26.63</td>\n",
       "      <td>26.63</td>\n",
       "      <td>5941600</td>\n",
       "      <td>0.41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-03</th>\n",
       "      <td>27.62</td>\n",
       "      <td>27.75</td>\n",
       "      <td>27.62</td>\n",
       "      <td>27.62</td>\n",
       "      <td>4788000</td>\n",
       "      <td>0.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-04</th>\n",
       "      <td>28.62</td>\n",
       "      <td>28.75</td>\n",
       "      <td>28.62</td>\n",
       "      <td>28.62</td>\n",
       "      <td>6966400</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-05</th>\n",
       "      <td>28.62</td>\n",
       "      <td>28.87</td>\n",
       "      <td>28.62</td>\n",
       "      <td>28.62</td>\n",
       "      <td>1982400</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-06</th>\n",
       "      <td>28.75</td>\n",
       "      <td>28.87</td>\n",
       "      <td>28.75</td>\n",
       "      <td>28.75</td>\n",
       "      <td>3466400</td>\n",
       "      <td>0.45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-09</th>\n",
       "      <td>27.50</td>\n",
       "      <td>27.50</td>\n",
       "      <td>27.25</td>\n",
       "      <td>27.25</td>\n",
       "      <td>4188800</td>\n",
       "      <td>0.42</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Open   High    Low  Close     Volume  Adj Close\n",
       "Date                                                        \n",
       "1980-12-12  28.75  28.87  28.75  28.75  117258400       0.45\n",
       "1980-12-15  27.38  27.38  27.25  27.25   43971200       0.42\n",
       "1980-12-16  25.37  25.37  25.25  25.25   26432000       0.39\n",
       "1980-12-17  25.87  26.00  25.87  25.87   21610400       0.40\n",
       "1980-12-18  26.63  26.75  26.63  26.63   18362400       0.41\n",
       "1980-12-19  28.25  28.38  28.25  28.25   12157600       0.44\n",
       "1980-12-22  29.63  29.75  29.63  29.63    9340800       0.46\n",
       "1980-12-23  30.88  31.00  30.88  30.88   11737600       0.48\n",
       "1980-12-24  32.50  32.63  32.50  32.50   12000800       0.51\n",
       "1980-12-26  35.50  35.62  35.50  35.50   13893600       0.55\n",
       "1980-12-29  36.00  36.13  36.00  36.00   23290400       0.56\n",
       "1980-12-30  35.25  35.25  35.12  35.12   17220000       0.55\n",
       "1980-12-31  34.25  34.25  34.13  34.13    8937600       0.53\n",
       "1981-01-02  34.50  34.75  34.50  34.50    5415200       0.54\n",
       "1981-01-05  33.87  33.87  33.75  33.75    8932000       0.53\n",
       "1981-01-06  32.37  32.37  32.25  32.25   11289600       0.50\n",
       "1981-01-07  31.00  31.00  30.88  30.88   13921600       0.48\n",
       "1981-01-08  30.37  30.37  30.25  30.25    9956800       0.47\n",
       "1981-01-09  31.88  32.00  31.88  31.88    5376000       0.50\n",
       "1981-01-12  31.88  31.88  31.62  31.62    5924800       0.49\n",
       "1981-01-13  30.63  30.63  30.50  30.50    5762400       0.48\n",
       "1981-01-14  30.63  30.75  30.63  30.63    3572800       0.48\n",
       "1981-01-15  31.25  31.50  31.25  31.25    3516800       0.49\n",
       "1981-01-16  31.12  31.12  31.00  31.00    3348800       0.48\n",
       "1981-01-19  32.87  33.00  32.87  32.87   10393600       0.51\n",
       "1981-01-20  32.00  32.00  31.88  31.88    7520800       0.50\n",
       "1981-01-21  32.50  32.75  32.50  32.50    3976000       0.51\n",
       "1981-01-22  32.87  33.13  32.87  32.87    8887200       0.51\n",
       "1981-01-23  32.87  33.00  32.75  32.75    2805600       0.51\n",
       "1981-01-26  32.37  32.37  32.25  32.25    6160000       0.50\n",
       "1981-01-27  32.25  32.25  32.00  32.00    5924800       0.50\n",
       "1981-01-28  31.12  31.12  31.00  31.00    7039200       0.48\n",
       "1981-01-29  30.00  30.00  29.87  29.87   10976000       0.47\n",
       "1981-01-30  28.50  28.50  28.25  28.25   11547200       0.44\n",
       "1981-02-02  26.75  26.75  26.63  26.63    5941600       0.41\n",
       "1981-02-03  27.62  27.75  27.62  27.62    4788000       0.43\n",
       "1981-02-04  28.62  28.75  28.62  28.62    6966400       0.45\n",
       "1981-02-05  28.62  28.87  28.62  28.62    1982400       0.45\n",
       "1981-02-06  28.75  28.87  28.75  28.75    3466400       0.45\n",
       "1981-02-09  27.50  27.50  27.25  27.25    4188800       0.42"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple.sort_index(ascending = True).head(40)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 找到每个月的最后一个交易日(business day)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Open</th>\n",
       "      <th>High</th>\n",
       "      <th>Low</th>\n",
       "      <th>Close</th>\n",
       "      <th>Volume</th>\n",
       "      <th>Adj Close</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1980-12-31</th>\n",
       "      <td>34.25</td>\n",
       "      <td>34.25</td>\n",
       "      <td>34.13</td>\n",
       "      <td>34.13</td>\n",
       "      <td>8937600</td>\n",
       "      <td>0.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-01-30</th>\n",
       "      <td>28.50</td>\n",
       "      <td>28.50</td>\n",
       "      <td>28.25</td>\n",
       "      <td>28.25</td>\n",
       "      <td>11547200</td>\n",
       "      <td>0.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-02-27</th>\n",
       "      <td>26.50</td>\n",
       "      <td>26.75</td>\n",
       "      <td>26.50</td>\n",
       "      <td>26.50</td>\n",
       "      <td>3690400</td>\n",
       "      <td>0.41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-03-31</th>\n",
       "      <td>24.75</td>\n",
       "      <td>24.75</td>\n",
       "      <td>24.50</td>\n",
       "      <td>24.50</td>\n",
       "      <td>3998400</td>\n",
       "      <td>0.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1981-04-30</th>\n",
       "      <td>28.38</td>\n",
       "      <td>28.62</td>\n",
       "      <td>28.38</td>\n",
       "      <td>28.38</td>\n",
       "      <td>3152800</td>\n",
       "      <td>0.44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-03-31</th>\n",
       "      <td>539.23</td>\n",
       "      <td>540.81</td>\n",
       "      <td>535.93</td>\n",
       "      <td>536.74</td>\n",
       "      <td>42167300</td>\n",
       "      <td>76.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-04-30</th>\n",
       "      <td>592.64</td>\n",
       "      <td>599.43</td>\n",
       "      <td>589.80</td>\n",
       "      <td>590.09</td>\n",
       "      <td>114160200</td>\n",
       "      <td>83.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-05-30</th>\n",
       "      <td>637.98</td>\n",
       "      <td>644.17</td>\n",
       "      <td>628.90</td>\n",
       "      <td>633.00</td>\n",
       "      <td>141005200</td>\n",
       "      <td>90.43</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-06-30</th>\n",
       "      <td>92.10</td>\n",
       "      <td>93.73</td>\n",
       "      <td>92.09</td>\n",
       "      <td>92.93</td>\n",
       "      <td>49482300</td>\n",
       "      <td>92.93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2014-07-31</th>\n",
       "      <td>96.27</td>\n",
       "      <td>96.80</td>\n",
       "      <td>93.92</td>\n",
       "      <td>95.35</td>\n",
       "      <td>65130000</td>\n",
       "      <td>95.35</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>404 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "              Open    High     Low   Close     Volume  Adj Close\n",
       "Date                                                            \n",
       "1980-12-31   34.25   34.25   34.13   34.13    8937600       0.53\n",
       "1981-01-30   28.50   28.50   28.25   28.25   11547200       0.44\n",
       "1981-02-27   26.50   26.75   26.50   26.50    3690400       0.41\n",
       "1981-03-31   24.75   24.75   24.50   24.50    3998400       0.38\n",
       "1981-04-30   28.38   28.62   28.38   28.38    3152800       0.44\n",
       "...            ...     ...     ...     ...        ...        ...\n",
       "2014-03-31  539.23  540.81  535.93  536.74   42167300      76.25\n",
       "2014-04-30  592.64  599.43  589.80  590.09  114160200      83.83\n",
       "2014-05-30  637.98  644.17  628.90  633.00  141005200      90.43\n",
       "2014-06-30   92.10   93.73   92.09   92.93   49482300      92.93\n",
       "2014-07-31   96.27   96.80   93.92   95.35   65130000      95.35\n",
       "\n",
       "[404 rows x 6 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple.resample('BM').last()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤10 数据集中最早的日期和最晚的日期相差多少天？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "12261"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "(apple.index.max() - apple.index.min()).days"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤11 在数据中一共有多少个月？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "404"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "apple_months = apple.resample('BM').mean()\n",
    "len(apple_months.index)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤12 按照时间顺序可视化```Adj Close```值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAx0AAAIBCAYAAAAs+tL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fWOHBuv7SAsUwPhTH+FAc956SDoKVWty9zsyeIlgFo5pgcvMn7v5pYlvXfSiO7acYxofi2H6KYXyEPZ2pwIPAXwkm228hOFkpSWTbugvFMD4Ux/hQHPdej18yF4LVBiz4Vs3+wFHAjd5Dv3ypPRTH9lMM40NxbD/FMD7c3c3sQIL675HAw+7+UIKb1a0ohvGhOMaH4rj3lHTscClBDd5x7l69p42lRYpj+ymG8aE4tp9iGB9rCMrSfq047jXFMD4Ux/hQHPeCyqtC9aUEiW5Hd6c4tp9iGB+KY/sphiIiEi9KOkREREREpEP16CVzRURERESk4ynpEBERERGRDqWkQ0REREREOpSSDhERERER6VBKOkREpM3MLGZm75nZEjN738yuMrPdHlPMbISZnd1ZbRQRka5DSYeIiOyNSnef6u6TgOOALwLX7+ExIwAlHSIiPZCWzBURkTYzszJ3z250fRTwNtAXGA78AcgK777M3eeZ2VvARGAF8ChwJ3ALwTeepwH3uPvvOm0nRESk0yjpEBGRNts16Qhv2waMB0qBOnevMrOxwJ/dfbqZHQVc7e4nhttfBPR395vNLA14E/iKu6/o1J0REZEOl5zoBoiIyD4nBbjbzKYCMWBcC9t9AZhiZqeH1/OAsQQjISIisg9R0iEiIu0WllfFgCKCuR0bgQMI5g5WtfQw4HJ3f6FTGikiIgmjieQiItIuZtYPuA+424Oa3TxgvbvXAV8DIuGmpUBOo4e+AFxiZinh84wzsyxERGSfo5EOERHZGxlm9h5BKVWUYOL4r8P77gWeNrOvA88D5eHti4CYmb0PPALcQbCi1TtmZsAm4NTO2gEREek8mkguIiIiIiIdSuVVIiIiIiLSoZR0iIiIiIhIh1LSISIiIiIiHUpJh4iIiIiIdCglHSIiIiIi0qGUdIiIiIiISIdS0iEiIiIiIh1KSYeIiIiIiHSo/w+EMCzpZA7XBwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 972x648 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "# makes the plot and assign it to a variable\n",
    "appl_open = apple['Adj Close'].plot(title = \"Apple Stock\")\n",
    "\n",
    "# changes the size of the graph\n",
    "fig = appl_open.get_figure()\n",
    "fig.set_size_inches(13.5, 9)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "# 练习10-删除数据\n",
    "## 鸢尾花数据"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤1 导入必要的库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤2 数据集地址"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# 运行以下代码\n",
    "path10 ='exercise_data/iris.csv'   # iris.csv"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤3 将数据集存成变量```iris```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>5.1</th>\n",
       "      <th>3.5</th>\n",
       "      <th>1.4</th>\n",
       "      <th>0.2</th>\n",
       "      <th>Iris-setosa</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.7</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.9</td>\n",
       "      <td>1.7</td>\n",
       "      <td>0.4</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   5.1  3.5  1.4  0.2  Iris-setosa\n",
       "0  4.9  3.0  1.4  0.2  Iris-setosa\n",
       "1  4.7  3.2  1.3  0.2  Iris-setosa\n",
       "2  4.6  3.1  1.5  0.2  Iris-setosa\n",
       "3  5.0  3.6  1.4  0.2  Iris-setosa\n",
       "4  5.4  3.9  1.7  0.4  Iris-setosa"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris = pd.read_csv(path10)\n",
    "iris.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤4 创建数据框的列名称"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "      <th>class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.7</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sepal_length  sepal_width  petal_length  petal_width        class\n",
       "0           5.1          3.5           1.4          0.2  Iris-setosa\n",
       "1           4.9          3.0           1.4          0.2  Iris-setosa\n",
       "2           4.7          3.2           1.3          0.2  Iris-setosa\n",
       "3           4.6          3.1           1.5          0.2  Iris-setosa\n",
       "4           5.0          3.6           1.4          0.2  Iris-setosa"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "iris = pd.read_csv(path10,names = ['sepal_length','sepal_width', 'petal_length', 'petal_width', 'class'])\n",
    "iris.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤5 数据框中有缺失值吗？"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sepal_length    0\n",
       "sepal_width     0\n",
       "petal_length    0\n",
       "petal_width     0\n",
       "class           0\n",
       "dtype: int64"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "pd.isnull(iris).sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤6 将列```petal_length```的第10到19行设置为缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "      <th>class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.7</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.9</td>\n",
       "      <td>1.7</td>\n",
       "      <td>0.4</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.3</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>4.4</td>\n",
       "      <td>2.9</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.1</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.7</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>4.8</td>\n",
       "      <td>3.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>4.8</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.1</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>4.3</td>\n",
       "      <td>3.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.1</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>5.8</td>\n",
       "      <td>4.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>5.7</td>\n",
       "      <td>4.4</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.4</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.9</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.4</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.3</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>5.7</td>\n",
       "      <td>3.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.3</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.8</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.3</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    sepal_length  sepal_width  petal_length  petal_width        class\n",
       "0            5.1          3.5           1.4          0.2  Iris-setosa\n",
       "1            4.9          3.0           1.4          0.2  Iris-setosa\n",
       "2            4.7          3.2           1.3          0.2  Iris-setosa\n",
       "3            4.6          3.1           1.5          0.2  Iris-setosa\n",
       "4            5.0          3.6           1.4          0.2  Iris-setosa\n",
       "5            5.4          3.9           1.7          0.4  Iris-setosa\n",
       "6            4.6          3.4           1.4          0.3  Iris-setosa\n",
       "7            5.0          3.4           1.5          0.2  Iris-setosa\n",
       "8            4.4          2.9           1.4          0.2  Iris-setosa\n",
       "9            4.9          3.1           1.5          0.1  Iris-setosa\n",
       "10           5.4          3.7           NaN          0.2  Iris-setosa\n",
       "11           4.8          3.4           NaN          0.2  Iris-setosa\n",
       "12           4.8          3.0           NaN          0.1  Iris-setosa\n",
       "13           4.3          3.0           NaN          0.1  Iris-setosa\n",
       "14           5.8          4.0           NaN          0.2  Iris-setosa\n",
       "15           5.7          4.4           NaN          0.4  Iris-setosa\n",
       "16           5.4          3.9           NaN          0.4  Iris-setosa\n",
       "17           5.1          3.5           NaN          0.3  Iris-setosa\n",
       "18           5.7          3.8           NaN          0.3  Iris-setosa\n",
       "19           5.1          3.8           NaN          0.3  Iris-setosa"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris.iloc[10:20,2:3] = np.nan\n",
    "iris.head(20)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤7 将缺失值全部替换为1.0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "      <th>class</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.7</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "      <td>Iris-setosa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145</th>\n",
       "      <td>6.7</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.2</td>\n",
       "      <td>2.3</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>146</th>\n",
       "      <td>6.3</td>\n",
       "      <td>2.5</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.9</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>147</th>\n",
       "      <td>6.5</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.2</td>\n",
       "      <td>2.0</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>148</th>\n",
       "      <td>6.2</td>\n",
       "      <td>3.4</td>\n",
       "      <td>5.4</td>\n",
       "      <td>2.3</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>5.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.1</td>\n",
       "      <td>1.8</td>\n",
       "      <td>Iris-virginica</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>150 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     sepal_length  sepal_width  petal_length  petal_width           class\n",
       "0             5.1          3.5           1.4          0.2     Iris-setosa\n",
       "1             4.9          3.0           1.4          0.2     Iris-setosa\n",
       "2             4.7          3.2           1.3          0.2     Iris-setosa\n",
       "3             4.6          3.1           1.5          0.2     Iris-setosa\n",
       "4             5.0          3.6           1.4          0.2     Iris-setosa\n",
       "..            ...          ...           ...          ...             ...\n",
       "145           6.7          3.0           5.2          2.3  Iris-virginica\n",
       "146           6.3          2.5           5.0          1.9  Iris-virginica\n",
       "147           6.5          3.0           5.2          2.0  Iris-virginica\n",
       "148           6.2          3.4           5.4          2.3  Iris-virginica\n",
       "149           5.9          3.0           5.1          1.8  Iris-virginica\n",
       "\n",
       "[150 rows x 5 columns]"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris.petal_length.fillna(1, inplace = True)\n",
    "iris"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤8 删除列```class```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>5.1</td>\n",
       "      <td>3.5</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>4.9</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>4.7</td>\n",
       "      <td>3.2</td>\n",
       "      <td>1.3</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sepal_length  sepal_width  petal_length  petal_width\n",
       "0           5.1          3.5           1.4          0.2\n",
       "1           4.9          3.0           1.4          0.2\n",
       "2           4.7          3.2           1.3          0.2\n",
       "3           4.6          3.1           1.5          0.2\n",
       "4           5.0          3.6           1.4          0.2"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "del iris['class']\n",
    "iris.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤9 将数据框前三行设置为缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sepal_length  sepal_width  petal_length  petal_width\n",
       "0           NaN          NaN           NaN          NaN\n",
       "1           NaN          NaN           NaN          NaN\n",
       "2           NaN          NaN           NaN          NaN\n",
       "3           4.6          3.1           1.5          0.2\n",
       "4           5.0          3.6           1.4          0.2"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris.iloc[0:3 ,:] = np.nan\n",
    "iris.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤10 删除有缺失值的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.9</td>\n",
       "      <td>1.7</td>\n",
       "      <td>0.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sepal_length  sepal_width  petal_length  petal_width\n",
       "3           4.6          3.1           1.5          0.2\n",
       "4           5.0          3.6           1.4          0.2\n",
       "5           5.4          3.9           1.7          0.4\n",
       "6           4.6          3.4           1.4          0.3\n",
       "7           5.0          3.4           1.5          0.2"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris = iris.dropna(how='any')\n",
    "iris.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "### 步骤11 重新设置索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>sepal_length</th>\n",
       "      <th>sepal_width</th>\n",
       "      <th>petal_length</th>\n",
       "      <th>petal_width</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.1</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.6</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>5.4</td>\n",
       "      <td>3.9</td>\n",
       "      <td>1.7</td>\n",
       "      <td>0.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4.6</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.4</td>\n",
       "      <td>0.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5.0</td>\n",
       "      <td>3.4</td>\n",
       "      <td>1.5</td>\n",
       "      <td>0.2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   sepal_length  sepal_width  petal_length  petal_width\n",
       "0           4.6          3.1           1.5          0.2\n",
       "1           5.0          3.6           1.4          0.2\n",
       "2           5.4          3.9           1.7          0.4\n",
       "3           4.6          3.4           1.4          0.3\n",
       "4           5.0          3.4           1.5          0.2"
      ]
     },
     "execution_count": null,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 运行以下代码\n",
    "iris = iris.reset_index(drop = True)\n",
    "iris.head()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "py35-paddle1.2.0"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
